if not SYSPATH then return end
    -----------------------------------------
    --大厅界面
    -----------------------------------------
    --require "sgpk.src.sound"
    local request 			= app.gamesUse("request")
    local model             = app.gamesUse("model")
    local model_common     	= app.model("common")
    local Rule 				= app.gamesUse("rule")
    local check 			= app.gamesUse("ruleCheck")
    local model 			= app.gamesUse("model")
    local conf 			= app.gamesUse("conf")
    local scheduler 		= require("framework.scheduler")
    local STATE 			= request.State        --桌子状态
    local M  	            = class("ZJHView",PanelInner)
    
    M.gameScene = nil
    M.playerNum = 2
    M.players = {}
    M.selfId = 0
    M.gameRoom = nil
    M.mySeatId = 0
    M.dismiss_suc = false
    M.dismissLayer = nil
    M.isOpen = false
    M.handler = nil
    M.cards = {}
    M.hostID = 0
    M.qlist = {}

    M.numnil = {}
    M.playerUidandCards = {}
    M.lastUid = false

    M.yiqi = false

    M.icon = {}

    M.resulTbl = {}
    M.ResulTbl = {}

    M.isKanpai = false
    M.isdianji = false

    M.isjiesuan = false
    
    M.dismissData = {}
    M.isDisMiss = false
    M.disMaster = nil
    M.size = nil
    
    function M:ctor()
        self.class.super.ctor(self)
        self:initFromConfig(nil,"zjh")
        self:init()
    end
    
    function M:onEnter()
        self.class.super.onEnter(self)
        --self:init()
    end
    
    function M:onExit()
    end
    
    function M:init()
        self.gameRoom = cc.uiloader:load("zjh/res/ZhajinhuaScene.csb")   --jcxj/res/MainScene.csb  zjh/res/ZhajinhuaScene.csb
        self:addChild(self.gameRoom)
        --MVC.requestTableInfo()
        Adaptive(self.gameRoom).h()
        self.size = self.gameRoom:getContentSize()

        self.bg = cc.uiloader:seekNodeByName(self.gameRoom, "img_time")
        self.time = cc.uiloader:seekNodeByName(self.gameRoom, "text_time")
        self.time:setString(os.date("%H:%M",os.time()))                           --时间
        print("时间：",self.time:getString())
        self.dianliang = cc.uiloader:seekNodeByName(self.gameRoom, "img_dianliang")     --电量
        self.wifi = cc.uiloader:seekNodeByName(self.gameRoom, "img_wifi")               --wifi

        Effects:addSpriteFrames("Voice")  --语言动画
        MVC.element()
    end
    
    function M:roomTable()
        print("炸金花-------------------------")
        -- dump(model.roomData._list)
        self.qlist = {}
        self.selfId = app.model("hall").Uid.get()
        self.GameOwner = 1
        self.mySeatId = self:getSeatidByUid(self.selfId)
        self.playerNum = model.roomData._tbl.MaxPlayerNum
        self.tbl = model.roomData._tbl
        self.tableID = model.roomData._roomid
        print("炸金花信息------------------------",self.selfId,self.GameOwner,self.mySeatId,self.playerNum,self.tbl,self.tableID)

        -- -------------------------------------------------
        self.GameRule = model.roomData._tbl.zhuang       --规则
        self.CurGameNum = model.roomData._tbl.CurGameNum   --当前局数
        self.GameRound = model.roomData._tbl.GameRound     --总局
    
        self.playerdate = model.roomData._list             --玩家数据
        -- --------------------------------------------------
        dump(model.roomData)
        print("新版测试----------------------------------------------")

    
         local zhubei = cc.uiloader:seekNodeByName(self.gameRoom, "panel_zunbei")
          
         local jiesan = cc.uiloader:seekNodeByName(self.gameRoom, "btn_jiesanfj")
         local back = cc.uiloader:seekNodeByName(self.gameRoom, "btn_returnhall")
         local friend = cc.uiloader:seekNodeByName(self.gameRoom, "btn_yaoqin")
         local start = cc.uiloader:seekNodeByName(self.gameRoom, "btn_zunbei")


         local seting = cc.uiloader:seekNodeByName(self.gameRoom, "btn_set")
         local yuyin = cc.uiloader:seekNodeByName(self.gameRoom, "btn_yuyin")
         local msg = cc.uiloader:seekNodeByName(self.gameRoom, "btn_xinxi")  --语音
        
        
        local function callBack(obj,e)
            if e == ccui.TouchEventType.ended then
                if obj:getName() == "btn_set" then
                    print("设置------------------------------------------------")
                    --MVC.reInGame()
                    --self:setTing()
                    -- self:result()
                    --AudioPlayer:playGameSound("sgpk","gamestart")
                    game.view.csbShow("common.setting","zjh")
                    --callBack(more_btn,ccui.TouchEventType.ended)
                elseif obj:getName() == "btn_xinxi" then
                    print("消息------------------------------------------------")
                    --game.view.csbShow("common.chat","jcxj")
                    MVC.chatLayer()
                elseif obj:getName() == "btn_jiesanfj" then
                    print("退出------------------------------------------------")
                    --game.view.csbShow("common.dismiss","sgpk")
                    MVC.dismiss()
                    --callBack(more_btn,ccui.TouchEventType.ended)
                elseif obj:getName() == "btn_returnhall" then
                    print("返回-----------------------------------------")
                    request:onRoomLeaveAction()

                    zhubei:setVisible(false)
                    -- MVC.leaveGame()
                    --callBack(more_btn,ccui.TouchEventType.ended)
                elseif obj:getName() == "btn_zunbei" then
                    --request:onGameStartAction()
                    request:onGameReady()
                    -- start:setVisible(false)
                    -- friend:setVisible(false)
                    zhubei:setVisible(false)
                elseif obj:getName() == "btn_yaoqin" then
                    MVC.facade:send(Event.EVENT_JCXJ_INVITE,"")
                    zhubei:setVisible(false)
                end
                --AudioPlayer:playGameSound("sgpk","btn")
            end
            if obj:getName() == "btn_yuyin" then
                  local pos = nil
                  if e == ccui.TouchEventType.began then
                      pos = obj:getTouchBeganPosition()
                  elseif e == ccui.TouchEventType.moved then
                      pos = obj:getTouchMovePosition()
                  elseif e == ccui.TouchEventType.ended then
                      pos = obj:getTouchEndPosition()
                  elseif e == ccui.TouchEventType.canceled then
                      pos = cc.p(1,1)
                  end
                  if pos then
                      MVC.talkLayer1(pos,e)
                      --self:talkLayer1(pos,e)
                  end
            end
        end
        
        yuyin:addTouchEventListener(callBack)
        seting:addTouchEventListener(callBack)
        back:addTouchEventListener(callBack)
        jiesan:addTouchEventListener(callBack)
        msg:addTouchEventListener(callBack)
        start:addTouchEventListener(callBack)
        friend:addTouchEventListener(callBack)

        
        local room_id = cc.uiloader:seekNodeByName(self.gameRoom, "text_fanhao")
        local ju = cc.uiloader:seekNodeByName(self.gameRoom, "text_lun")
        local guizhe = cc.uiloader:seekNodeByName(self.gameRoom, "text_rule")

        local dan = cc.uiloader:seekNodeByName(self.gameRoom, "text_danzhu_num")
        local zong = cc.uiloader:seekNodeByName(self.gameRoom, "text_zongzhu_num")

        room_id:setString("房号:" .. model.roomData._roomid)
        ju:setString("局数:" .. self.tbl.CurGameNum .. "/" .. self.tbl.GameRound)
        guizhe:setString(conf.ruleTextTab[model.roomData._tbl.bipai] .. conf.ruleTextTab3[model.roomData._tbl.huihexuanzhe] .. "第1轮")
         
        dan:setString("0")
        zong:setString("0")

         self:createPlayer()
          --IP报警
        if #model.roomData._list > 2 and self:isIpWaring() == true then
            game.view.csbShow("common.waringIp","zjh")
        end
    end

    function M:isIpWaring()
        local arr = model.roomData._list
        local ipData = {}
        local idxs = 0
        for k,v in pairs(arr) do
            if self.selfId ~= v.Uid then
                if ipData[v.IP] then
                    table.insert( ipData[v.IP], v.Uid)
                else
                    idxs = idxs + 1
                    ipData[v.IP] = {idx = #ipData + idxs}
                    table.insert( ipData[v.IP], v.Uid)
                end
            end
        end
        if next(ipData) ~= nil then
            return true
        else
            return false
        end
    end

    function M:reConnection(data)
         print("断线重连--------------------------------------",data.state)
         dump(data)
        local state = data.state
        self.cards = data.info[self.mySeatId].handcard
        self:hideBtnStartAndFriend()
        self:huifushuju(data)
        
        self.playerUidandCards = {}
        for k,v in pairs(data.info) do
            if data.info[k].playstate == 1 then
                table.insert(self.playerUidandCards,data.info[k].Uid)
            end
        end

        if data.info[self.mySeatId].checkstate == 1 then
            self.isKanpai = true
        end

        if state == STATE.start_Start then      --401,      --游戏开始
            
        elseif state == STATE.start_Zhuang then     --402,      --进入抢庄模式
          
        elseif state == STATE.start_Bit then        --406,      --进入下注模式
            print("断线炸金花开始游戏状态-----------------------------------------------",state)
            if data.info[self.mySeatId].checkstate == 0 then
                self:createPlayerCard1(data.info)
            else
                self:kanCard1(data.info)
            end
            if self.selfId == data.public.nextid then
                self:setBetBtn1(data)
            end
            if data.totalbrightbets ~= 0 then  --data.info[self.mySeatId].brightbets ~= 0
                for i = 1, data.totalbrightbets do
                    self:showCionEff1(data.info[self.mySeatId].Uid,false)
                end
            end
            if data.totaldarkbets ~= 0 then  --data.info[self.mySeatId].darkbets ~= 0
                for i = 1, data.totaldarkbets do
                    print("yikuan--------------------------------------------------------------")
                    self:showCionEff1(data.info[self.mySeatId].Uid,true)
                end
            end
        
        elseif state == STATE.Licensing then
                 
        elseif state== STATE.start_Sign_Resule then          --408,      --进入小结算模式
            print("断线炸金花小结算游戏状态-----------------------------------------------")
            -- self.resulTbl = data.clearing
            -- self:signResule()

            local playerArr = model.roomData._list
            if playerArr[self.mySeatId].b_start > -1 then
                for key, var in pairs(playerArr) do
                    local uid = model.roomData._list[key].Uid
                    if var.b_start > -1 then
                        self:showReady(var)     
                    end
                end
            else
                self.resulTbl = data.clearing
                local num
                if  model.roomData._tbl.huihexuanzhe == 1 then
                    num = 20
                elseif model.roomData._tbl.huihexuanzhe == 2 then
                    num = 30
                elseif model.roomData._tbl.huihexuanzhe == 3 then
                    num = 40    
                end
                if data.roundnum > num then
                    self:signResuleJ()
                else
                    self:signResule()
                end
            end     
         end

         local jiesanList = data.jiesanlist
         if #jiesanList > 0 then
             -- if not GAME_PATH[model_hall.KindId.get()].PANEL_TYPE then
             --     MVC.facade:send(Event.EVENT_DISMISS,jiesanList)
             --     local dt = {}
             --     for k,v in pairs(jiesanList) do
             --         if k ~= 1 then
             --             dt[k] = v
             --         end
             --     end
             --     if #dt > 0 then
             --         MVC.facade:send(Event.EVENT_DISMISS_UPDATE,dt)
             --     end
             -- else
                 model.disMaster = math.abs(jiesanList[1])
                 local pan = game.view.getOrCreateView("common.dismiss","zjh")
                 pan:createDisMiss()
                 for k,v in pairs(jiesanList) do
                     if k ~= 1 then
                         model.dismissData[math.abs(v)] = v
                     end
                 end
                 if #model.dismissData > 0 then
                     pan:disMissUpdate()
                 end
             --end
         else
             game.view.back("common.dismiss","zjh")
         end
         self:setPlayerstate(data)
     end

     --玩家状态
function M:setPlayerstate(data)
    for k,v in pairs(data.info) do
        local seatId = swichPos(k,self.mySeatId,self.playerNum,1)
        local pan = cc.uiloader:seekNodeByName(self.gameRoom, "img_cell" .. seatId)
        local lixian = cc.uiloader:seekNodeByName(pan, "lixian")
        if v.Isonline == 1 then
            lixian:setVisible(true)
        else
            lixian:setVisible(false)
        end
    end
end


     function M:huifushuju(data)
        local dan = cc.uiloader:seekNodeByName(self.gameRoom, "text_danzhu_num")
        local zong = cc.uiloader:seekNodeByName(self.gameRoom, "text_zongzhu_num")
        if not self.isKanpai then
            dan:setString(data.nowdarkbet)
        else
            dan:setString(data.nowbrightbet)
        end
        zong:setString(data.totalbet)
        
        local guizhe = cc.uiloader:seekNodeByName(self.gameRoom, "text_rule")
        guizhe:setString(conf.ruleTextTab[model.roomData._tbl.bipai] .. conf.ruleTextTab3[model.roomData._tbl.huihexuanzhe] .. "第".. data.roundnum .."轮")
        -- self.tang:setString(":" .. data.public.tangdi)
        for key,var in pairs(data.info) do
            local seatid = self:getSeatidByUid(var.Uid)
            local _seatid = swichPos(seatid,self.mySeatId,self.playerNum,1)
            local player = cc.uiloader:seekNodeByName(self.gameRoom, "img_cell" .. _seatid)
            local bet_num = cc.uiloader:seekNodeByName(player, "bet_num"):setString("下注数:" .. var.bet)
            -- local seatid = self:getSeatidByUid(var.Uid)
            print("ccccccccccccccccccccccccccccccccccc",data.info[key].Uid,data.public.hostid)
            if data.info[key].Uid ~= data.public.hostid then
                local seatid = self:getSeatidByUid(data.info[key].Uid)
                local _seatid = swichPos(seatid,self.mySeatId,self.playerNum,1)
                local pan = cc.uiloader:seekNodeByName(self.gameRoom, "img_cell" .. _seatid)
                local id = cc.uiloader:seekNodeByName(pan,"lb_nam"):setVisible(true)
                -- id:setString(data.info[key]._yxb)
            else
                local seatid = self:getSeatidByUid(data.public.hostid)
                local _seatid = swichPos(seatid,self.mySeatId,self.playerNum,1)
                local pan = cc.uiloader:seekNodeByName(self.gameRoom, "img_cell" .. _seatid)
                local id = cc.uiloader:seekNodeByName(pan,"lb_nam"):setVisible(true)
                --id:setString(tonumber(data.info[key]._yxb) - tonumber(data.public.tangdi) + tonumber(conf.ruleTextTab[self.GameRule]))
            end
        end

     end


  
    function M:action_jcxj_table(data)
        print("总控制--------------------------------------",data.state)
        -- dump(data)
        local state = data.state
        print("总控制--------------------------------------",state)
        dump(data)
        self.playerstate = data.playerstate
        
        local playerNum = #model.roomData._list
        
        if state == STATE.start_Start then  --401
            for i = 1,#model.roomData._list do
                model.roomData._list[i].b_start = -1
            end
            self.playerUidandCards = {}
            local arr = model.roomData._list
            for k,v in pairs(arr) do
                table.insert(self.playerUidandCards,v.Uid)
            end
    
            local ju = cc.uiloader:seekNodeByName(self.gameRoom, "text_lun")
            ju:setString("第" .. data.data.CurGameNum .. "/" .. self.tbl.GameRound .. "局")
            self:hideBtnStartAndFriend()
        elseif state == STATE.start_Zhuang then    
            --dump(data)
            -- self:setQiangZhuangBtn(data.playerstate)
        elseif state == STATE.Licensing then       --发牌 101
            print("炸金的卡牌数据--------------------")
            -- dump(data)    
            self.cards = data.data.handcard
            self:createPlayerCard(data)

            for i = 1, #model.roomData._list do
                self:showCionEff1(data.data.Uid,true)
            end

        elseif state == STATE.Get_cards then    
            self.cards = data.data._card
            --dump(self.cards)
        elseif state == STATE.start_Wait then
            self:init()
        elseif state == STATE.start_Bit then    --下注模式 406
            print("炸金花点完开始出现下注--------------------")
            --  dump(data)

             self.hostID = data.data.hostid
             self:setZhuang(data)
             self:setBetBtn(data)

            --self:setBetBtn(data)
            -- self:setRobZhuang(data)

        elseif state == STATE.start_Brand then   --407
            print("扎金花亮牌数据--------------------------")
            -- dump(data)
            self:yancreateCard(data)
            --self:createCard(data)
        elseif state == STATE.Discard_card then   --108
             print("广播返回108888888888888888888888888888888888")
             self:qipai(data)

        elseif state == STATE.Bit then          --下注 106
            print("扎金花下注后-------------------------------------------------------------")
            -- dump(data)
            self:setBetBtn(data)
            self:showCionEff(data)
            -- self:showBetNum(data)
        elseif state == STATE.End_compcard then   --比牌 112112
            print("扎金花亮牌数据------------------------------------")
            -- dump(data)
            self:PKcard(data)
            
            for i = 1, 2 do
                if not self.isKanpai then
                    self:showCionEff1(data.data.Uid,true)
                else
                    self:showCionEff1(data.data.Uid,false)
                end
            end

            -- -- dump(data.data)
            -- self:showClock(false)
            -- --self:showCard(true)
            -- local sedtid = self:getSeatidByUid(data.data.Uid)
            -- if self.selfId ~= sedtid then
            --     self:createCard(sedtid,data.data,data.data._cardtype)
            -- else
            --     self:setCardType(sedtid,data.data._cardtype)
            -- end
           
        elseif state == STATE.Look_card then   --看牌 107
            self:kanCard(data)
            self:yikanpai(data)
            -- print("--亮牌 110")
            -- local sedtid = self:getSeatidByUid(data.data.Uid)
            -- if self.selfId ~= data.data.Uid then
            --     --self:createCard(sedtid,data.data._card,data.data._cardtype)
            --     self:createCard(data)
            -- else
            --     self:setCardType(sedtid,data.data._cardtype)
            -- end
        elseif state == STATE.Call then    --抢庄 109 1为庄家 否则0
            
            local guizhe = cc.uiloader:seekNodeByName(self.gameRoom, "text_rule")
            if data.data and data.data.roundnum then
                guizhe:setString(conf.ruleTextTab[model.roomData._tbl.bipai] .. conf.ruleTextTab3[model.roomData._tbl.huihexuanzhe] .. "第".. data.data.roundnum .."轮")
            end

            self:setBetBtn(data)
            self:showCionEff(data)
            -- if data.data.num > 0 then
            --     table.insert( self.qlist, data.data.Uid)
            -- end
            -- self:setRobZhuang(data.data.Uid,data.data.num)
        else
            -- self.curscore = data.data.curscore
            -- self.allscore = data.data.allscore
            -- self:signResule(data.data)

            -- --亮牌-------------------------------
            -- print("亮牌-------------------------------------")
            -- dump(data)
            -- self:showClock(false)
            -- --self:showCard(true)
            -- --local sedtid = self:getSeatidByUid(data.data.Uid)
            -- --if self.selfId ~= sedtid then
            --     self:createCard(data)
            -- -- else
            -- --     self:setCardType(sedtid,data.data._cardtype)
            -- -- end
            

        end
    end

    function M:yancreateCard(data)
        runDelayAction(self.gameRoom,1,function()
            self:createCard(data)
        end)
    end

    function M:kanCard(data)
       if data.data and data.data.handcard then
       local seat = self:getSeatidByUid(data.data.Uid)
       local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)
       local cards = cc.uiloader:seekNodeByName(self.gameRoom,"cards_"..seat_id)

       for i=1,3 do
        cards:removeChildByTag(i*100+i)
       end

       for k,v in pairs(data.data.handcard) do
            local str = "common/card/card_6_1.png"
            if v ~= 0 then
                local typ,val = self:typeAndValue(tonumber(v))
                str = "common/card/card_" .. typ .."_" .. val .. ".png"
            end
            local sp = display.newSprite(str)
            sp:setPosition(cc.p(250 * k ,0)) --325
            sp:setScale(1.2)
            sp:setTag(k*100 + k)
            sp:setLocalZOrder(k*10 + k)
            cards:addChild(sp)

       end
    
    end
    end

    function M:kanCard1(data)
        local PlayerArray = model.roomData._list
        print("///////////////////////////////////////////////////\\\n")

        for key, var in pairs(PlayerArray) do
            local seat_id = self:getSeatidByUid(var.Uid)
            local _seatid = swichPos(seat_id,self.mySeatId,self.playerNum,1)
            print("------------ss----------------",key,self.playerNum,_seatid)
            local pan = cc.uiloader:seekNodeByName(self.gameRoom, "cards_" .. _seatid)
            local kanpai = cc.uiloader:seekNodeByName(pan, "img_button")
            print("怎么回事----------------------------",kanpai)
            kanpai:setScale(2)
            kanpai:setLocalZOrder(200)
            kanpai:setPosition(cc.p(500,10))
            kanpai:setColor(cc.c3b(160,160,160))

            local bol = false
            local sc = 0.55
            local offx = 120
            if _seatid ~= 1 then
                sc = 0.3
                offx = 40
            end
            -- dump(self.cards)
            print("==============================================")
            -- AudioPlayer:playGameSound("sgpk","fapai")
            if self.mySeatId == key then
                for k, v in pairs(data[self.mySeatId].handcard) do
                    local str = "common/card/card_6_1.png"
                    print("///////////////////////////////////////////////////")
                    if v ~= 0 then
                        local typ,val = self:typeAndValue(tonumber(v))
                        str = "common/card/card_" .. typ .."_" .. val .. ".png"
                    end
                    local eff = display.newSprite(str)
                    eff:setScale(0.3)
                    eff:setPosition(cc.p(self.size.width/2,self.size.height/2))
                    self.gameRoom:addChild(eff)
                    local pos1 = pan:convertToWorldSpace(cc.p( offx * k ,0))
                    local arr = {}
                    arr[#arr + 1] = cc.MoveTo:create(k * 0.03,pos1)
                    arr[#arr + 1] = cc.CallFunc:create(function ()
                        local sp = cc.Sprite:create(str)
                        sp:setPosition(cc.p(250 * k ,0)) --325
                        sp:setScale(1.2)
                        sp:setTag(k*100 + k)
                        sp:setLocalZOrder(k*10 + k)
                        pan:addChild(sp)
                    end)
                    arr[#arr + 1] = cc.RemoveSelf:create()
                    local seq = cc.Sequence:create(arr)
                    eff:runAction(seq)
                    -- kanpai:setVisible(false)
                end
                if data[key].checkstate == 1 then --以看牌
                    self:yishu(data[key].Uid)
                elseif data[key].playstate == -1 then --弃牌
                    self:yishu(data[key].Uid)
                elseif data[key].playstate == 0 then --以输
                    self:yishu(data[key].Uid)
                end
            else
                if data[key].checkstate == 1 then --以看牌
                    self:yikanpai1(data[key].Uid)
                elseif data[key].playstate == -1 then --弃牌
                    self:qipai1(data[key].Uid)
                elseif data[key].playstate == 0 then --以输
                    self:yishu(data[key].Uid)
                end
                for v = 1, 3 do
                    local str = "common/card/card_6_1.png"
                    local eff = display.newSprite(str)
                    eff:setPosition(cc.p(self.size.width/2,self.size.height/2))
                    eff:setScale(0.7)
                    self.gameRoom:addChild(eff)
                    local pos1 = pan:convertToWorldSpace(cc.p( offx * v ,0))
                    local arr = {}
                    arr[#arr + 1] = cc.MoveTo:create(v * 0.03,pos1)
                    arr[#arr + 1] = cc.CallFunc:create(function ()
                         local sp = cc.Sprite:create(str)
                        sp:setPosition(cc.p(100 * v ,0))
                        sp:setScale(0.6)
                        sp:setTag(v*100 + v) 
                        sp:setLocalZOrder(v*10 + v)
                        pan:addChild(sp)
                    end)
                    arr[#arr + 1] = cc.RemoveSelf:create()
                    local seq = cc.Sequence:create(arr)
                    eff:runAction(seq)
                end
            end 
        end  
    --     dump(data)
    --     -- if data.data and data.data.handcard then
    --     local seat = self:getSeatidByUid(data.Uid)
    --     local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)
    --     local cards = cc.uiloader:seekNodeByName(self.gameRoom,"cards_"..seat_id)
 
    --     for i=1,3 do
    --      cards:removeChildByTag(i*100+i)
    --     end
 
    --     for k,v in pairs(data.handcard) do
    --          local str = "common/card/card_6_1.png"
    --          if v ~= 0 then
    --              local typ,val = self:typeAndValue(tonumber(v))
    --              str = "common/card/card_" .. typ .."_" .. val .. ".png"
    --          end
    --          local sp = display.newSprite(str)
    --          sp:setPosition(cc.p(250 * k ,0)) --325
    --          sp:setScale(1.2)
    --          sp:setTag(k*100 + k)
    --          sp:setLocalZOrder(k*10 + k)
    --          cards:addChild(sp)
 
    --     end
     
    -- --  end
     end


    function M:createCard(data)
        print("牌的数据----------------------------------------------")
        -- dump(data)

        local time = 0.5
        for key,var in pairs(self.playerUidandCards) do
            local seatid = self:getSeatidByUid(var)
            local _seatid = swichPos(seatid,self.mySeatId,self.playerNum,1)
            print("RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR",_seatid)
            local pan = cc.uiloader:seekNodeByName(self.gameRoom, "cards_" .. _seatid)
            pan:removeAllChildren()

            --runDelayAction(self.gameRoom,time,function()
            
                --for k = j,#data.cards[seatid] do
                    -- dump(data.cards[_seatid])
                for k,v in pairs(data.cards[seatid]) do
                    if type(k) == "number" then
                    local str = "common/card/card_6_1.png"
                    local typ,val = self:typeAndValue(tonumber(data.cards[seatid][k]))
                    str = "common/card/card_" .. typ .."_" .. val .. ".png"
                    local sp = display.newSprite(str)
                 
                    if _seatid ~= 1 then
                        sp:setPosition(cc.p(100 * k ,0))
                        sp:setScale(0.9)
                    else
                        sp:setPosition(cc.p(360 * k ,0)) --325
                        sp:setScale(1.5)
                    end
                    sp:setTag(k*100 + k)
                    sp:setLocalZOrder(k*10 + k)
                    pan:addChild(sp)
                    end
            end
            -- end)
            -- time = time + 0.5
        end
        

        runDelayAction(self.gameRoom,2,function()
            self:setCardType(data)
         end)

    end


    function M:resultdata(data)
        self.resulTbl = data
        print("NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN",#self.resulTbl)
        dump(self.resulTbl) 
        -- if not self.isResult then
        --     self:signResule()
        -- end
        if not self.isResult and self.yiqi then
            self:signResule()
        end
        -- if self.isjiesuan then
        --     self:signResuleJ()
        -- end
        if not self.isResult and self.isjiesuan then
            -- self:signResuleJ()
            self:createcards()
        end
    end

    function M:createcards()
       for key,var in pairs(self.resulTbl) do
        local seat = self:getSeatidByUid(var.Uid)
        local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)
        local cards = cc.uiloader:seekNodeByName(self.gameRoom,"cards_"..seat_id)
        for i=1,3 do
            cards:removeChildByTag(i*100+i)
        end
        for k,v in pairs(var.handcard) do
            local str = "common/card/card_6_1.png"
            print("///////////////////////////////////////////////////")
            if v ~= 0 then
                local typ,val = self:typeAndValue(tonumber(v))
                str = "common/card/card_" .. typ .."_" .. val .. ".png"
            end
            local eff = display.newSprite(str)
            eff:setLocalZOrder(10000)
            if seat_id == 1 then
                eff:setScale(1.2)
                eff:setPosition(cc.p(250 * k ,0))
            else
                eff:setPosition(cc.p(100 * k ,0))
                eff:setScale(0.6)
            end
            eff:setTag(k*100 + k)
            cards:addChild(eff)
        end
       end
       
       runDelayAction(self.gameRoom,2,function()
          self:signResuleJ()
       end)
    end

    




    function M:signResule()
        local signresule = cc.CSLoader:createNode("zjh/res/JieSuanLayer.csb")
        self.gameRoom:addChild(signresule,9999)
        
        local list = cc.uiloader:seekNodeByName(signresule,"list")

        local btn = cc.uiloader:seekNodeByName(signresule,"btn_queding")

        btn:addTouchEventListener(function (obj,e)
        if e == ccui.TouchEventType.ended then
            if #self.ResulTbl > 0 then
                signresule:removeFromParent()
                signresule = nil
                self:result()
            else
                signresule:removeFromParent()
                signresule = nil
                self:reSetData()
                request:onGameReady()
            end
        end
        end)

        for key,var in pairs(self.resulTbl) do
            local seat = self:getSeatidByUid(var.Uid)
            local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)
            local player = cc.uiloader:seekNodeByName(self.gameRoom,"img_cell" .. seat_id)
            print("1111aaaaaaaaaaaaaaaaaaaaaa",player)
            local id = cc.uiloader:seekNodeByName(player,"lb_nam")
            print("aaaaaaaaaaaaaaaaaaaaaa",id)
            id:setString(self.resulTbl[key].yxb)
        end
        
        local win = cc.uiloader:seekNodeByName(signresule,"img_title_win")
        local lose = cc.uiloader:seekNodeByName(signresule,"img_title_shu")
        
        for k,v in pairs(self.resulTbl) do
            if self.selfId == v.Uid then
                if v.winstate > 0 then
                    win:setVisible(true)
                else
                    lose:setVisible(true)
                end
            end
        end
        
        local dyjCl = nil
        local scoreMax = 0
        local arr = model.roomData._list
        for key,var in pairs(arr) do
            local cl = cc.uiloader:seekNodeByName(signresule,"panel_user"):clone()
            cl:setPosition(cc.p(650,550 - key*100))

            local name = cc.uiloader:seekNodeByName(cl,"text_name")
            name:setString(var.name)
            
            local card = cc.uiloader:seekNodeByName(cl,"img_card")
            
            local seat = self:getSeatidByUid(var.Uid)
            cl:setTag(var.Uid)
            for k,v in pairs(self.resulTbl[seat].handcard) do
                local str = "common/card/card_6_1.png"
                -- if v ~= 0 then
                --     local typ,val = self:typeAndValue(tonumber(v))
                --     str = "common/card/card_" .. typ .."_" .. val .. ".png"
                -- end
                local sp = display.newSprite(str)
                sp:setScale(0.7)
                sp:setPosition(cc.p(-180 + k*150,1))
                card:addChild(sp)
            end
            local score = cc.uiloader:seekNodeByName(cl,"img_num") 
            local totleScore = self:createImageNum(self.resulTbl[seat].money)
            totleScore:setScale(0.8)
            totleScore:setName(key)
            score:addChild(totleScore)
            
            if scoreMax < self.resulTbl[key].money then
                scoreMax = self.resulTbl[key].money
                dyjCl = cl
            end

            list:addChild(cl)  --pushBackCustomItem
        end
        if dyjCl then
            cc.uiloader:seekNodeByName(dyjCl, "img_win"):setVisible(true)
        end  

        for key,var in pairs(self.resulTbl) do
            if var.Uid == self.selfId then
                --自己的
                local cl = list:getChildByTag(var.Uid)
                local cards = cc.uiloader:seekNodeByName(cl,"img_card")
                cards:removeAllChildren()
                local seat = self:getSeatidByUid(var.Uid)
                for k,v in pairs(self.resulTbl[seat].handcard) do
                    local str = "common/card/card_6_1.png"
                    if v ~= 0 then
                        local typ,val = self:typeAndValue(tonumber(v))
                        str = "common/card/card_" .. typ .."_" .. val .. ".png"
                    end
                    local sp = display.newSprite(str)
                    sp:setScale(0.7)
                    sp:setPosition(cc.p(-180 + k*150,1))
                    cards:addChild(sp)
                end
                --和别人比牌的
                for k,v in pairs(self.resulTbl[seat].compareduser) do
                    local cl = list:getChildByTag(v)
                    local cards = cc.uiloader:seekNodeByName(cl,"img_card")
                    cards:removeAllChildren()
                    local seat = self:getSeatidByUid(v)
                    for k,v in pairs(self.resulTbl[seat].handcard) do
                        local str = "common/card/card_6_1.png"
                        if v ~= 0 then
                            local typ,val = self:typeAndValue(tonumber(v))
                            str = "common/card/card_" .. typ .."_" .. val .. ".png"
                        end
                        local sp = display.newSprite(str)
                        sp:setScale(0.7)
                        sp:setPosition(cc.p(-180 + k*150,1))
                        cards:addChild(sp)
                    end
                end
            end
        end

        local data = os.date("%Y-%m-%d %H:%M:%S");  --当前时间
        cc.uiloader:seekNodeByName(signresule, "text_time"):setString(data)
        cc.uiloader:seekNodeByName(signresule, "text_fanhao"):setString("房间号:" .. model.roomData._roomid)



        -- local cl = cc.uiloader:seekNodeByName(signresule,"panel_user"):clone()
        -- cl:setPosition(cc.p(620,500))
        -- signresule:addChild(cl)  --pushBackCustomItem

        -- --dump(data)       
        -- local seat_id = self:getSeatidByUid(data.Uid)
        -- local seat = swichPos(seat_id,self.mySeatId,self.playerNum,1)

        -- print("输赢位置和分数----------------------",seat,self.mySeatId)
        
        -- local function fen()
        -- local sq =
        -- transition.sequence(
        -- {
        --     cc.EaseSineOut:create(cc.ScaleTo:create(0.2, 1.0)),  --动作由快变慢
        --     cc.FadeIn:create(0.2),                               --从暗到亮
        --     cc.MoveBy:create(0.5, cc.p(0, 30)),      
        --     cc.DelayTime:create(0.2),                            
        --     cc.FadeOut:create(0.2)                               
        -- }
        -- )

        -- local player = cc.uiloader:seekNodeByName(self.gameRoom, "cell_" .. seat)
        
        -- local posy = 140
        -- if seat == 2 or seat == 5 then
        --     posy = 205
        -- end
        
        -- local game_win_score = nil
        -- if tonumber(data.curscore) >= 0 then
        --     game_win_score =
        --         cc.Label:createWithCharMap("sgpk/res/actor/MJ_win_score_font.png", 28, 38, string.byte("0"))
        -- else
        --     game_win_score =
        --         cc.Label:createWithCharMap("sgpk/res/actor/MJ_lose_score_font.png", 28, 38, string.byte("0"))
        -- end
        -- cc.uiloader:seekNodeByName(player, "id"):setString(data.allscore)
        -- game_win_score:setName("winscore")
        -- player:addChild(game_win_score)
        -- game_win_score:setVisible(true)
        -- game_win_score:setString(":" .. data.curscore)
        -- game_win_score:setPosition(cc.p(100, posy))
        -- game_win_score:runAction(sq)

        -- if seat == self.mySeadId then
        --     if data.curscore > 0 then
        --         self:showWin(data.curscore)
        --     else
        --         self:showLose(data.curscore)
        --     end
        -- end
        -- end


        
        -- local function showCoin()
        -- local uid = data.Uid
        -- for i,lostUid in pairs(data._lostlist) do
        --     self:showWinCionEff(uid,lostUid)
        -- end
        -- end
        
        -- local function showDown()
        -- if seat_id == self.mySeatId then 
        --     if data.curscore > 0 then
        --         print("输赢位置---------------------showWin-")
        --         self:showWin(data.curscore)
        --     else
        --         print("输赢位置---------------------showLose-")
        --         self:showLose(data.curscore)
        --     end
        -- end
        -- end

        -- if #model.roomData._list ==2 then
        --     time = 3
        --     time1= 4
        -- elseif #model.roomData._list ==3 then
        --     time = 5
        --     time1= 6
        -- elseif #model.roomData._list ==4 then
        --     time = 6.5
        --     time1= 7.5
        -- elseif #model.roomData._list ==5 then
        --     time = 7.5
        --     time1= 8.5
        -- end
        
        -- runDelayAction(self.gameRoom, time, fen)
        -- runDelayAction(self.gameRoom, time, showCoin)
        -- runDelayAction(self.gameRoom, time1, showDown)
    
     end
     
     function M:signResuleJ()
        local signresule = cc.CSLoader:createNode("zjh/res/JieSuanLayer.csb")
        self.gameRoom:addChild(signresule,9999)
        
        local list = cc.uiloader:seekNodeByName(signresule,"list")

        local btn = cc.uiloader:seekNodeByName(signresule,"btn_queding")

        btn:addTouchEventListener(function (obj,e)
        if e == ccui.TouchEventType.ended then
            if #self.ResulTbl > 0 then
                signresule:removeFromParent()
                signresule = nil
                self:result()
            else
                signresule:removeFromParent()
                signresule = nil
                self:reSetData()
                request:onGameReady()
            end
        end
        end)

        for key,var in pairs(self.resulTbl) do
            local seat = self:getSeatidByUid(var.Uid)
            local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)
            local player = cc.uiloader:seekNodeByName(self.gameRoom,"img_cell" .. seat_id)
            print("1111aaaaaaaaaaaaaaaaaaaaaa",player)
            local id = cc.uiloader:seekNodeByName(player,"lb_nam")
            print("aaaaaaaaaaaaaaaaaaaaaa",id)
            id:setString(self.resulTbl[key].yxb)
        end
        
        local win = cc.uiloader:seekNodeByName(signresule,"img_title_win")
        local lose = cc.uiloader:seekNodeByName(signresule,"img_title_shu")
        
        for k,v in pairs(self.resulTbl) do
            if self.selfId == v.Uid then
                if v.winstate > 0 then
                    win:setVisible(true)
                else
                    lose:setVisible(true)
                end
            end
        end
        
        local dyjCl = nil
        local scoreMax = 0
        local arr = model.roomData._list
        for key,var in pairs(arr) do
            local cl = cc.uiloader:seekNodeByName(signresule,"panel_user"):clone()
            cl:setPosition(cc.p(650,550 - key*100))

            local name = cc.uiloader:seekNodeByName(cl,"text_name")
            name:setString(var.name)
            
            local card = cc.uiloader:seekNodeByName(cl,"img_card")
            
            local seat = self:getSeatidByUid(var.Uid)
            cl:setTag(var.Uid)
            for k,v in pairs(self.resulTbl[seat].handcard) do
                local str = "common/card/card_6_1.png"
                if v ~= 0 then
                    local typ,val = self:typeAndValue(tonumber(v))
                    str = "common/card/card_" .. typ .."_" .. val .. ".png"
                end
                local sp = display.newSprite(str)
                sp:setScale(0.7)
                sp:setPosition(cc.p(-180 + k*150,1))
                card:addChild(sp)
            end
            local score = cc.uiloader:seekNodeByName(cl,"img_num") 
            local totleScore = self:createImageNum(self.resulTbl[seat].money)
            totleScore:setScale(0.8)
            totleScore:setName(key)
            score:addChild(totleScore)
            
            if scoreMax < self.resulTbl[key].money then
                scoreMax = self.resulTbl[key].money
                dyjCl = cl
            end

            list:addChild(cl)  --pushBackCustomItem
        end
        if dyjCl then
            cc.uiloader:seekNodeByName(dyjCl, "img_win"):setVisible(true)
        end  

        -- for key,var in pairs(self.resulTbl) do
        --     if var.Uid == self.selfId then
        --         --自己的
        --         local cl = list:getChildByTag(var.Uid)
        --         local cards = cc.uiloader:seekNodeByName(cl,"img_card")
        --         cards:removeAllChildren()
        --         local seat = self:getSeatidByUid(var.Uid)
        --         for k,v in pairs(self.resulTbl[seat].handcard) do
        --             local str = "common/card/card_6_1.png"
        --             if v ~= 0 then
        --                 local typ,val = self:typeAndValue(tonumber(v))
        --                 str = "common/card/card_" .. typ .."_" .. val .. ".png"
        --             end
        --             local sp = display.newSprite(str)
        --             sp:setScale(0.7)
        --             sp:setPosition(cc.p(-180 + k*150,1))
        --             cards:addChild(sp)
        --         end
        --         --和别人比牌的
        --         for k,v in pairs(self.resulTbl[seat].compareduser) do
        --             local cl = list:getChildByTag(v)
        --             local cards = cc.uiloader:seekNodeByName(cl,"img_card")
        --             cards:removeAllChildren()
        --             local seat = self:getSeatidByUid(v)
        --             for k,v in pairs(self.resulTbl[seat].handcard) do
        --                 local str = "common/card/card_6_1.png"
        --                 if v ~= 0 then
        --                     local typ,val = self:typeAndValue(tonumber(v))
        --                     str = "common/card/card_" .. typ .."_" .. val .. ".png"
        --                 end
        --                 local sp = display.newSprite(str)
        --                 sp:setScale(0.7)
        --                 sp:setPosition(cc.p(-180 + k*150,1))
        --                 cards:addChild(sp)
        --             end
        --         end
        --     end
        -- end

        local data = os.date("%Y-%m-%d %H:%M:%S");  --当前时间
        cc.uiloader:seekNodeByName(signresule, "text_time"):setString(data)
        cc.uiloader:seekNodeByName(signresule, "text_fanhao"):setString("房间号:" .. model.roomData._roomid)
     end    

    --准备
    function M:setReadyBtn(bol,uid)
        print("准备------------------------")
        local ready = cc.uiloader:seekNodeByName(self.gameRoom, "btn_zhunbei")
        local friend = cc.uiloader:seekNodeByName(self.gameRoom, "btn_invite")
        friend:setVisible(bol)
        ready:setVisible(bol)
        if bol then
            ready:addTouchEventListener(function (obj,e)
                if e == ccui.TouchEventType.ended then
                    print("点击-------------------------",uid)
                    --request:onGameStartAction()
                    request:onGameReady(uid)
                    -- request:onGameReady(uid)
                    ready:setVisible(false)
                    friend:setVisible(false)
                    --ready1:setVisible(true)
                    
                    --self:reSetData()
                end
            end)
        end
    end

    function M:showReady(data)
        print("准备111--------------------------")
        local seat = self:getSeatidByUid(data.Uid)
        local seat_id = swichPos(seat, self.mySeatId, self.playerNum,1)
        local player = cc.uiloader:seekNodeByName(self.gameRoom, "img_cell".. seat_id)
        local ready = cc.uiloader:seekNodeByName(player, "img_zb"):setVisible(true)
    end

--     --显示闹钟
-- function M:showClock(visible)
--     local clock_bg = cc.uiloader:seekNodeByName(self.gameRoom, "clock_bg")
--     local game_clock_label = clock_bg:getChildByName("clock_num")
--     if self.gameRoom then
--         --local clock_bg = cc.uiloader:seekNodeByName(self.gameRoom, "clock_bg")
--         --local game_clock_label = clock_bg:getChildByName("clock_num")
--         if visible then
--             clock_bg:setVisible(true)
--             setCountDown(
--                 game_clock_label,
--                 30,
--                 function()
--                     clock_bg:setVisible(false)
--                 end
--             )
--         else
--             if game_clock_label ~= nil then
--             if game_clock_label.dt then
--                 Scheduler.unscheduleGlobal(game_clock_label.dt)
--                 clock_bg:setVisible(false)
--             end
--             end
--         end
--     end
-- end

    --清理数据
    function M:reSetData()
        local arr = model.roomData._list
        for key,var in pairs(arr) do
            local seat = self:getSeatidByUid(var.Uid)
            local seat_id = swichPos(seat, self.mySeatId, self.playerNum,1)
            local player = cc.uiloader:seekNodeByName(self.gameRoom, "img_cell" .. seat_id)

            local zhuang = cc.uiloader:seekNodeByName(player, "img_zhuang"):setVisible(false)
            
            local bet_num = cc.uiloader:seekNodeByName(player, "bet_num"):setString("下注数:0")
            -- cc.uiloader:seekNodeByName(player, "btn_invite"):setVisible(false)
            -- cc.uiloader:seekNodeByName(player, "btn_start"):setVisible(false)
            
            -- local icon = self.gameRoom:getChildByName("icon")
            -- if icon then
            --     icon:removeFromParent()
            -- end      
            local card = cc.uiloader:seekNodeByName(self.gameRoom, "cards_" .. seat_id)
            card:setColor(cc.c3b(255,255,255))


 
            local cards = cc.uiloader:seekNodeByName(self.gameRoom, "cards_" .. seat_id)
            local kanpai = cc.uiloader:seekNodeByName(cards, "img_button"):setVisible(false)
            for i=1,3 do
                cards:removeChildByTag(i*100+i)
            end

            self.isKanpai = false
            self.resulTbl = {}
        end

        for k,v in pairs(self.icon) do
            if v ~= nil then
                self.gameRoom:removeChildByTag(v)
          end
        end

        local guizhe = cc.uiloader:seekNodeByName(self.gameRoom, "text_rule")
        guizhe:setString(conf.ruleTextTab[model.roomData._tbl.bipai] .. conf.ruleTextTab3[model.roomData._tbl.huihexuanzhe] .. "第1轮")
        -- self.tang:setString(":" .. data.public.tangdi)

        self.resulTbl = {}
        self.ResulTbl = {}
        
        self.yiqi = false
        self.isKanpai = false
        self.isjiesuan = false
        -- self.readyNum = 0
        -- self.effNum = 0
        -- self.resultNum = 0
        self.playerUidandCards = {}
        print("大清除后uid-------------------------")
        print("大清除后uid-------------------------")
        print("大清除后uid-------------------------")
        dump(self.playerUidandCards)
    end    
    
    --下注效果
    function M:showBetNum(data)
        print("发了几次-------------------------------",data.Uid,data.num)

        local seat_id = self:getSeatidByUid(data.Uid)
        
        local seatid = swichPos(seat_id, self.mySeatId, self.playerNum,1) --位置转化
       
        local posy = 120
        if seatid == 2 and seatid == 6 then
            posy = 225
        end
        local player = cc.uiloader:seekNodeByName(self.gameRoom, "img_player_" .. seatid)
        -- player:removeChildByTag(10000 + seatid)
        -- local game_palyer_Bet = cc.Label:createWithCharMap("jxcj/res/BankerStartGame/sgpk_bet_font.png", 24, 33, string.byte("0"))
        -- game_palyer_Bet:setName("setbet")
        -- game_palyer_Bet:setAnchorPoint(cc.p(0, 0.5))
        -- game_palyer_Bet:setString(":" .. data.num)
        -- game_palyer_Bet:setPosition(cc.p(10, posy))
        -- game_palyer_Bet:setTag(10000 + seatid)
        -- player:addChild(game_palyer_Bet)
        local game_palyer_Bet = cc.LabelAtlas:_create(":"..data.num,"jcxj/res/BankerStartGame/sgpk_bet_font.png", 24, 33, string.byte("0"))
        game_palyer_Bet:setPosition(cc.p(50 ,posy))
        game_palyer_Bet:setName("setbet")
        game_palyer_Bet:setAnchorPoint(cc.p(0,0.5))
        player:addChild(game_palyer_Bet)
    end

    --下注效果
    function M:dxshowBetNum(uid,num)
        -- print("发了几次-------------------------------",data.Uid,data.num)

        local seat_id = self:getSeatidByUid(uid)
        
        local seatid = swichPos(seat_id, self.mySeatId, self.playerNum,1) --位置转化
       
        local posy = 120
        if seatid == 2 and seatid == 6 then
            posy = 225
        end
        local player = cc.uiloader:seekNodeByName(self.gameRoom, "img_player_" .. seatid)
        -- player:removeChildByTag(10000 + seatid)
        -- local game_palyer_Bet = cc.Label:createWithCharMap("jxcj/res/BankerStartGame/sgpk_bet_font.png", 24, 33, string.byte("0"))
        -- game_palyer_Bet:setName("setbet")
        -- game_palyer_Bet:setAnchorPoint(cc.p(0, 0.5))
        -- game_palyer_Bet:setString(":" .. data.num)
        -- game_palyer_Bet:setPosition(cc.p(10, posy))
        -- game_palyer_Bet:setTag(10000 + seatid)
        -- player:addChild(game_palyer_Bet)
        local game_palyer_Bet = cc.LabelAtlas:_create(":"..num,"jcxj/res/BankerStartGame/sgpk_bet_font.png", 24, 33, string.byte("0"))
        game_palyer_Bet:setPosition(cc.p(50 ,posy))
        game_palyer_Bet:setName("setbet")
        game_palyer_Bet:setAnchorPoint(cc.p(0,0.5))
        player:addChild(game_palyer_Bet)
    end

    function M:setBetBtn(data)
        -- local coins = cc.uiloader:seekNodeByName(self.gameRoom, "panel_coins"):setVisible(false)
        local dan = cc.uiloader:seekNodeByName(self.gameRoom, "text_danzhu_num")
        local zong = cc.uiloader:seekNodeByName(self.gameRoom, "text_zongzhu_num")

       if data and data.data and data.data.bet then
            local seat = self:getSeatidByUid(data.data.Uid) 
            local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)       
            local player = cc.uiloader:seekNodeByName(self.gameRoom, "img_cell" .. seat_id)
            local bet_num = cc.uiloader:seekNodeByName(player, "bet_num"):setString("下注数:" .. data.data.bet)
       end

        -- local guizhe = cc.uiloader:seekNodeByName(self.gameRoom, "text_rule")

        -- if data.data and data.data.addbet then
        --     dan:setString(data.data.addbet)
        -- else
            if not self.isKanpai then
                dan:setString(data.data.nowdarkbet)
            else
                dan:setString(data.data.nowbrightbet)
            end
        --end
        zong:setString(data.data.totalbet)       
        

        local uid = data.data.nextid
          -- local seat = self:getSeatidByUid(uid)
         local seat = self:getSeatidByUid(uid) 
         local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)       
         local pan = cc.uiloader:seekNodeByName(self.gameRoom, "cards_" .. seat_id)
         local kanpai = cc.uiloader:seekNodeByName(pan, "img_button")

        local xiazhu = cc.uiloader:seekNodeByName(self.gameRoom,"panel_rule")
        

        local jiazhuNum_0 = cc.uiloader:seekNodeByName(self.gameRoom,"panel_jiazhu_0")
        local jiazhuNum_1 = cc.uiloader:seekNodeByName(self.gameRoom,"panel_jiazhu_1")

        local Panel_jiazhu_2 = cc.uiloader:seekNodeByName(self.gameRoom,"Panel_jiazhu_2")
        Panel_jiazhu_2:setLocalZOrder(2999)
        local jiazhuNum_3 = cc.uiloader:seekNodeByName(Panel_jiazhu_2,"panel_jiazhu_0")
        local jiazhuNum_4 = cc.uiloader:seekNodeByName(Panel_jiazhu_2,"panel_jiazhu_1")

        local Panel_jiazhu_3 = cc.uiloader:seekNodeByName(self.gameRoom,"Panel_jiazhu_3")
        Panel_jiazhu_3:setLocalZOrder(2999)
        local jiazhuNum_5 = cc.uiloader:seekNodeByName(Panel_jiazhu_3,"panel_jiazhu_0")
        local jiazhuNum_6 = cc.uiloader:seekNodeByName(Panel_jiazhu_3,"panel_jiazhu_1")

        
        for var = 1,5 do
            local zhu = cc.uiloader:seekNodeByName(self.gameRoom, "btn_jiazhu_0_" .. var)
     
            --下注按钮图片切割
            local xiazhufeng = cc.Label:createWithCharMap("zjh/res/zhajinhua/0201.png", 26, 35, string.byte("0"))
            xiazhufeng:setName("beishufeng"..var)
            xiazhufeng:setAnchorPoint(cc.p(0.5, 0.5))
            xiazhufeng:setString("/" .. var)
            
            xiazhufeng:setPosition(cc.p(85, 50))
            zhu:addChild(xiazhufeng)

            zhu:addTouchEventListener(function (obj,e)  
                if e == ccui.TouchEventType.ended then
                    local tag = obj:getTag()
                    if data.data.nowdarkbet + tag <= 5 then
                        jiazhuNum_0:setVisible(false)
                        request:sendActionNum(106,tag)
                    else
                        Prompt.ShowNoticeSysMsg(TEXT("当前下注数超过5不可下注"))
                        jiazhuNum_0:setVisible(false)
                        xiazhu:setVisible(true)
                    end
                    -- request:sendAction(STATE.Bit,{Uid = uid, num = tag})
                    -- request:sendAction(STATE.Bit,{Uid = uid, num = tag,type = 2})
                    -- xiazhuNum:setVisible(false)
                    -- xiazhuNum1:setVisible(false)
                    -- xiazhuNum2:setVisible(false)
                end
            end)
        end

        for var = 1,10 do
            if var%2 == 0 then
                local zhu = cc.uiloader:seekNodeByName(self.gameRoom, "btn_jiazhu_1_" .. var)
        
                --下注按钮图片切割
                local xiazhufeng = cc.Label:createWithCharMap("zjh/res/zhajinhua/0201.png", 26, 35, string.byte("0"))
                xiazhufeng:setName("beishufeng"..var)
                xiazhufeng:setAnchorPoint(cc.p(0.5, 0.5))
                xiazhufeng:setString("/" .. var)
                
                xiazhufeng:setPosition(cc.p(85, 50))
                zhu:addChild(xiazhufeng)

                zhu:addTouchEventListener(function (obj,e)  
                    if e == ccui.TouchEventType.ended then
                        local tag = obj:getTag()
                        if data.data.nowbrightbet + tag <= 10 then
                            request:sendActionNum(106,tag)
                            jiazhuNum_1:setVisible(false)
                        else
                            Prompt.ShowNoticeSysMsg(TEXT("当前下注数超过10不可下注"))
                            jiazhuNum_1:setVisible(false)
                            xiazhu:setVisible(true)
                        end     
                    end
                end)
            end
        end

        for var = 1,10 do
            local zhu = cc.uiloader:seekNodeByName(self.gameRoom, "btn_jiazhu_1" .. var)
     
            --下注按钮图片切割
            local xiazhufeng = cc.Label:createWithCharMap("zjh/res/zhajinhua/0201.png", 26, 35, string.byte("0"))
            xiazhufeng:setName("beishufeng"..var)
            xiazhufeng:setAnchorPoint(cc.p(0.5, 0.5))
            xiazhufeng:setString("/" .. var)
            
            xiazhufeng:setPosition(cc.p(85, 50))
            zhu:addChild(xiazhufeng)

            zhu:addTouchEventListener(function (obj,e)  
                if e == ccui.TouchEventType.ended then
                    local tag = obj:getTag()
                    if data.data.nowdarkbet + tag <= 10 then
                        request:sendActionNum(106,tag)
                        Panel_jiazhu_2:setVisible(false)
                    else
                        Prompt.ShowNoticeSysMsg(TEXT("当前下注数超过10不可下注"))
                        Panel_jiazhu_2:setVisible(false)
                        xiazhu:setVisible(true)
                    end
                end
            end)
        end

        for var = 1,20 do
            if var%2 == 0 then
                local zhu = cc.uiloader:seekNodeByName(self.gameRoom, "btn_jiazhu_2" .. var)
        
                --下注按钮图片切割
                local xiazhufeng = cc.Label:createWithCharMap("zjh/res/zhajinhua/0201.png", 26, 35, string.byte("0"))
                xiazhufeng:setName("beishufeng"..var)
                xiazhufeng:setAnchorPoint(cc.p(0.5, 0.5))
                xiazhufeng:setString("/" .. var)
                
                xiazhufeng:setPosition(cc.p(85, 50))
                zhu:addChild(xiazhufeng)

                zhu:addTouchEventListener(function (obj,e)  
                    if e == ccui.TouchEventType.ended then
                        local tag = obj:getTag()
                        if data.data.nowbrightbet + tag <= 20 then
                            request:sendActionNum(106,tag)
                            Panel_jiazhu_3:setVisible(false)
                        else
                            Prompt.ShowNoticeSysMsg(TEXT("当前下注数超过20不可下注"))
                            Panel_jiazhu_3:setVisible(false)
                            xiazhu:setVisible(true)
                        end
                    end
                end)
            end
        end


        local bipai = cc.uiloader:seekNodeByName(self.gameRoom,"btn_bipai")
        local genzhu = cc.uiloader:seekNodeByName(self.gameRoom,"btn_genzhu")
        local jiazhu = cc.uiloader:seekNodeByName(self.gameRoom,"btn_jiazhu")
        local qipai = cc.uiloader:seekNodeByName(self.gameRoom,"btn_qipai")

        -- if uid == self.selfId and data.playerstate == 1 then
        if uid == self.selfId then
            if not self.isKanpai then
                kanpai:setVisible(true)
            end
            xiazhu:setVisible(true)
             if data.data.button[1] == 1 then  --1010/1000=1
                kanpai:setColor(cc.c3b(255,255,255))
                kanpai:setTouchEnabled(true)
             elseif data.data.button[1] == 0 then
                kanpai:setColor(cc.c3b(160,160,160))
                kanpai:setTouchEnabled(false)
             end
            if data.data.button[2] == 1 then --(1010%1000)/100=1
                genzhu:setColor(cc.c3b(255,255,255))
                genzhu:setTouchEnabled(true)
            elseif data.data.button[2] == 0 then
                genzhu:setColor(cc.c3b(160,160,160))
                genzhu:setTouchEnabled(false)
            end
            if data.data.button[3] == 1 then --(1010%100)/10=1
                jiazhu:setColor(cc.c3b(255,255,255))
                jiazhu:setTouchEnabled(true)
            elseif data.data.button[3] == 0 then
                jiazhu:setColor(cc.c3b(160,160,160))
                jiazhu:setTouchEnabled(false)
            end
            if data.data.button[4] == 1 then  --1010%10=1
                bipai:setColor(cc.c3b(255,255,255))
                bipai:setTouchEnabled(true)
            elseif data.data.button[4] == 0 then
                bipai:setColor(cc.c3b(160,160,160))
                bipai:setTouchEnabled(false)
            end
            if data.data.button[5] == 1 then  --1010%10=1
                qipai:setColor(cc.c3b(255,255,255))
                qipai:setTouchEnabled(true)
            elseif data.data.button[5] == 0 then
                qipai:setColor(cc.c3b(160,160,160))
                qipai:setTouchEnabled(false)
            end
        end

        local roundnum = 0
        if data.data and data.data.roundnum and data.data.roundnum then
            roundnum = data.data.roundnum
        end
        local num = conf.ruleTextTab4[model.roomData._tbl.huihexuanzhe]
        if roundnum == tonumber(num) + 1 then -- and #self.ResulTbl > 0 
            self.isjiesuan = true
            xiazhu:setVisible(false)
        end
        
        local function callBack(obj,e)
            if e == ccui.TouchEventType.ended then
                local fen
                if obj:getName() == "btn_bipai" then
                    self:bipai(uid)
                    xiazhu:setVisible(false)
                    kanpai:setVisible(false)
                    -- for i = 1, 2 do
                    --     if not self.isKanpai then
                    --         self:showCionEff1(uid,true)
                    --     else
                    --         self:showCionEff1(uid,false)
                    --     end
                    -- end
                    -- request:sendAction(STATE.Bit,{Uid = uid, num = data.fenshu_P,type = 6})
                    -- xiazhu:setVisible(false)
                elseif obj:getName() == "btn_genzhu" then
                    print("跟注的数据----------------------------------",data.data.nowdarkbet)
                    xiazhu:setVisible(false)
                    kanpai:setVisible(false)
                    if not self.isKanpai then
                        request:sendActionNum(109,data.data.nowdarkbet)
                    else
                        request:sendActionNum(109,data.data.nowbrightbet)
                    end
                    -- request:sendAction(STATE.Bit,{Uid = uid, num = data.data.maxdarkbet})
                    -- request:sendAction(STATE.Bit,{Uid = uid, num = data.fenshu_Y,type = 4})
                    -- xiazhu:setVisible(false)
                elseif obj:getName() == "btn_jiazhu" then
                    kanpai:setVisible(false)
                    if model.roomData._tbl.jiazhu == 1 then
                        if not self.isKanpai then     --if data.data.betstate == 0 then  not self.isKanpai
                            jiazhuNum_0:setVisible(true)
                        else
                            jiazhuNum_1:setVisible(true)
                        end
                    else
                        if not self.isKanpai then
                            Panel_jiazhu_2:setVisible(true)
                        else
                            Panel_jiazhu_3:setVisible(true)
                        end
                    end
                    xiazhu:setVisible(false)
                    -- request:sendAction(STATE.Bit,{Uid = uid, num = 10,type = 1})
                    -- xiazhu:setVisible(false)
                elseif obj:getName() == "btn_qipai" then
                    kanpai:setVisible(false)
                    request:sendAction(108)
                    xiazhu:setVisible(false)
                    --request:sendAction(STATE.Bit,{Uid = uid, num = 30})
                    -- xiazhu:setVisible(false)
                    -- if self.GameRule == 1 then
                        -- xiazhuNum:setVisible(true)
                    -- elseif self.GameRule == 2 then
                        -- xiazhuNum:setVisible(true)
                        -- xiazhuNum1:setVisible(true)
                    -- else
                        -- xiazhuNum:setVisible(true)
                        -- xiazhuNum1:setVisible(true)
                        -- xiazhuNum2:setVisible(true)
                    --end
                    
                elseif obj:getName() == "img_button" then
                    print("点击----------------------------",uid,self.mySeatId)
                        request:SendAction(STATE.Look_card,{Uid = uid})
                        kanpai:setVisible(false)
                        self.isKanpai = true
                end
            end
        end

        bipai:addTouchEventListener(callBack)
        genzhu:addTouchEventListener(callBack)
        jiazhu:addTouchEventListener(callBack)
        qipai:addTouchEventListener(callBack)
        kanpai:addTouchEventListener(callBack)

        -- P:addTouchEventListener(callBack)
        -- Y:addTouchEventListener(callBack)
        -- jishu:addTouchEventListener(callBack)
        -- huozhu:addTouchEventListener(callBack)

    
        

        -- for var = 1,5 do
        --     local zhu = cc.uiloader:seekNodeByName(self.gameRoom, "bet_" .. var)
        --     zhu:setVisible(true)
        --     zhu:addTouchEventListener(function (obj,e)
        --         if e == ccui.TouchEventType.ended then
        --             local tag = obj:getTag()
        --             request:sendAction(STATE.Bit,{Uid = uid, num = tag*2})

        --             for var = 1, 5 do
        --                 cc.uiloader:seekNodeByName(self.gameRoom, "bet_" .. var):setVisible(false)
        --             end
        --         end
        --     end)
        -- end
    end
    function M:setBetBtn1(data)
        -- local coins = cc.uiloader:seekNodeByName(self.gameRoom, "panel_coins"):setVisible(false)
        local dan = cc.uiloader:seekNodeByName(self.gameRoom, "text_danzhu_num")
        local zong = cc.uiloader:seekNodeByName(self.gameRoom, "text_zongzhu_num")
        -- if not self.isKanpai then
        --     dan:setString(data.nowdarkbet)
        --     print("1111111111111111111111111111111111111",data.nowdarkbet)
        -- else
        --     dan:setString(data.nowbrightbet)
        --     print("2222222222222222222222222222222222222",data.nowbrightbet)
        -- end
        -- -- dan:setString(data.nowbrightbet)
        -- zong:setString(data.totalbet)       
 

        local uid = data.public.nextid

         local seat = self:getSeatidByUid(uid) 
         local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)       
         local pan = cc.uiloader:seekNodeByName(self.gameRoom, "cards_" .. seat_id)
         local kanpai = cc.uiloader:seekNodeByName(pan, "img_button")

        local xiazhu = cc.uiloader:seekNodeByName(self.gameRoom,"panel_rule")
       

        local jiazhuNum_0 = cc.uiloader:seekNodeByName(self.gameRoom,"panel_jiazhu_0")
        local jiazhuNum_1 = cc.uiloader:seekNodeByName(self.gameRoom,"panel_jiazhu_1")

        local Panel_jiazhu_2 = cc.uiloader:seekNodeByName(self.gameRoom,"Panel_jiazhu_2")
        Panel_jiazhu_2:setLocalZOrder(2999)
        local jiazhuNum_3 = cc.uiloader:seekNodeByName(Panel_jiazhu_2,"panel_jiazhu_0")
        local jiazhuNum_4 = cc.uiloader:seekNodeByName(Panel_jiazhu_2,"panel_jiazhu_1")

        local Panel_jiazhu_3 = cc.uiloader:seekNodeByName(self.gameRoom,"Panel_jiazhu_3")
        Panel_jiazhu_3:setLocalZOrder(2999)
        local jiazhuNum_5 = cc.uiloader:seekNodeByName(Panel_jiazhu_3,"panel_jiazhu_0")
        local jiazhuNum_6 = cc.uiloader:seekNodeByName(Panel_jiazhu_3,"panel_jiazhu_1")
        
        for var = 1,5 do
            local zhu = cc.uiloader:seekNodeByName(self.gameRoom, "btn_jiazhu_0_" .. var)
     
            --下注按钮图片切割
            local xiazhufeng = cc.Label:createWithCharMap("zjh/res/zhajinhua/0201.png", 26, 35, string.byte("0"))
            xiazhufeng:setName("beishufeng"..var)
            xiazhufeng:setAnchorPoint(cc.p(0.5, 0.5))
            xiazhufeng:setString("/" .. var)
            
            xiazhufeng:setPosition(cc.p(85, 50))
            zhu:addChild(xiazhufeng)

            zhu:addTouchEventListener(function (obj,e)  
                if e == ccui.TouchEventType.ended then
                    local tag = obj:getTag()
                    if data.nowdarkbet + tag <= 5 then
                        jiazhuNum_0:setVisible(false)
                        request:sendActionNum(106,tag)
                    else
                        Prompt.ShowNoticeSysMsg(TEXT("当前下注数超过5不可下注"))
                        jiazhuNum_0:setVisible(false)
                        xiazhu:setVisible(true)
                    end
                    -- request:sendAction(STATE.Bit,{Uid = uid, num = tag})
                    -- request:sendAction(STATE.Bit,{Uid = uid, num = tag,type = 2})
                    -- xiazhuNum:setVisible(false)
                    -- xiazhuNum1:setVisible(false)
                    -- xiazhuNum2:setVisible(false)
                end
            end)
        end

        for var = 1,10 do
            if var%2 == 0 then
                local zhu = cc.uiloader:seekNodeByName(self.gameRoom, "btn_jiazhu_1_" .. var)
        
                --下注按钮图片切割
                local xiazhufeng = cc.Label:createWithCharMap("zjh/res/zhajinhua/0201.png", 26, 35, string.byte("0"))
                xiazhufeng:setName("beishufeng"..var)
                xiazhufeng:setAnchorPoint(cc.p(0.5, 0.5))
                xiazhufeng:setString("/" .. var)
                
                xiazhufeng:setPosition(cc.p(85, 50))
                zhu:addChild(xiazhufeng)

                zhu:addTouchEventListener(function (obj,e)  
                    if e == ccui.TouchEventType.ended then
                        local tag = obj:getTag()
                        if data.nowbrightbet + tag <= 10 then
                            request:sendActionNum(106,tag)
                            jiazhuNum_1:setVisible(false)
                        else
                            Prompt.ShowNoticeSysMsg(TEXT("当前下注数超过10不可下注"))
                            jiazhuNum_1:setVisible(false)
                            xiazhu:setVisible(true)
                        end     
                    end
                end)
            end
        end

        for var = 1,10 do
            local zhu = cc.uiloader:seekNodeByName(self.gameRoom, "btn_jiazhu_1" .. var)
     
            --下注按钮图片切割
            local xiazhufeng = cc.Label:createWithCharMap("zjh/res/zhajinhua/0201.png", 26, 35, string.byte("0"))
            xiazhufeng:setName("beishufeng"..var)
            xiazhufeng:setAnchorPoint(cc.p(0.5, 0.5))
            xiazhufeng:setString("/" .. var)
            
            xiazhufeng:setPosition(cc.p(85, 50))
            zhu:addChild(xiazhufeng)

            zhu:addTouchEventListener(function (obj,e)  
                if e == ccui.TouchEventType.ended then
                    local tag = obj:getTag()
                    if data.nowdarkbet + tag <= 10 then
                        request:sendActionNum(106,tag)
                        Panel_jiazhu_2:setVisible(false)
                    else
                        Prompt.ShowNoticeSysMsg(TEXT("当前下注数超过10不可下注"))
                        Panel_jiazhu_2:setVisible(false)
                        xiazhu:setVisible(true)
                    end
                end
            end)
        end

        for var = 1,20 do
            if var%2 == 0 then
                local zhu = cc.uiloader:seekNodeByName(self.gameRoom, "btn_jiazhu_2" .. var)
        
                --下注按钮图片切割
                local xiazhufeng = cc.Label:createWithCharMap("zjh/res/zhajinhua/0201.png", 26, 35, string.byte("0"))
                xiazhufeng:setName("beishufeng"..var)
                xiazhufeng:setAnchorPoint(cc.p(0.5, 0.5))
                xiazhufeng:setString("/" .. var)
                
                xiazhufeng:setPosition(cc.p(85, 50))
                zhu:addChild(xiazhufeng)

                zhu:addTouchEventListener(function (obj,e)  
                    if e == ccui.TouchEventType.ended then
                        local tag = obj:getTag()
                        if data.nowbrightbet + tag <= 20 then
                            request:sendActionNum(106,tag)
                            Panel_jiazhu_3:setVisible(false)
                        else
                            Prompt.ShowNoticeSysMsg(TEXT("当前下注数超过20不可下注"))
                            Panel_jiazhu_3:setVisible(false)
                            xiazhu:setVisible(true)
                        end
                    end
                end)
            end
        end


        local bipai = cc.uiloader:seekNodeByName(self.gameRoom,"btn_bipai")
        local genzhu = cc.uiloader:seekNodeByName(self.gameRoom,"btn_genzhu")
        local jiazhu = cc.uiloader:seekNodeByName(self.gameRoom,"btn_jiazhu")
        local qipai = cc.uiloader:seekNodeByName(self.gameRoom,"btn_qipai")
    
                
        
        -- if uid == self.selfId and data.playerstate == 1 then
        if uid == self.selfId then
            if not self.isKanpai then
                kanpai:setVisible(true)
            else
                kanpai:setVisible(false)
            end
            xiazhu:setVisible(true)
             if data.button[1] == 1 then  --1010/1000=1
                kanpai:setColor(cc.c3b(255,255,255))
                kanpai:setTouchEnabled(true)
             elseif data.button[1] == 0 then
                kanpai:setColor(cc.c3b(160,160,160))
                kanpai:setTouchEnabled(false)
             end
            if data.button[2] == 1 then --(1010%1000)/100=1
                genzhu:setColor(cc.c3b(255,255,255))
                genzhu:setTouchEnabled(true)
            elseif data.data.button[2] == 0 then
                genzhu:setColor(cc.c3b(160,160,160))
                genzhu:setTouchEnabled(false)
            end
            if data.button[3] == 1 then --(1010%100)/10=1
                jiazhu:setColor(cc.c3b(255,255,255))
                jiazhu:setTouchEnabled(true)
            elseif data.data.button[3] == 0 then
                jiazhu:setColor(cc.c3b(160,160,160))
                jiazhu:setTouchEnabled(false)
            end
            if data.button[4] == 1 then  --1010%10=1
                bipai:setColor(cc.c3b(255,255,255))
                bipai:setTouchEnabled(true)
            elseif data.button[4] == 0 then
                bipai:setColor(cc.c3b(160,160,160))
                bipai:setTouchEnabled(false)
            end
            if data.button[5] == 1 then  --1010%10=1
                qipai:setColor(cc.c3b(255,255,255))
                qipai:setTouchEnabled(true)
            elseif data.button[5] == 0 then
                qipai:setColor(cc.c3b(160,160,160))
                qipai:setTouchEnabled(false)
            end
        end
        
        local function callBack(obj,e)
            if e == ccui.TouchEventType.ended then
                local fen
                if obj:getName() == "btn_bipai" then
                    self:bipai(uid)
                    xiazhu:setVisible(false)
                    kanpai:setVisible(false)
                elseif obj:getName() == "btn_genzhu" then
                    xiazhu:setVisible(false)
                    kanpai:setVisible(false)
                    if not self.isKanpai then
                        request:sendActionNum(109,data.nowdarkbet)
                    else
                        request:sendActionNum(109,data.nowbrightbet)
                    end
                elseif obj:getName() == "btn_jiazhu" then
                    kanpai:setVisible(false)
                    if model.roomData._tbl.jiazhu == 1 then
                        if not self.isKanpai then     --if data.data.betstate == 0 then  not self.isKanpai
                            jiazhuNum_0:setVisible(true)
                        else
                            jiazhuNum_1:setVisible(true)
                        end
                    else
                        if not self.isKanpai then
                            Panel_jiazhu_2:setVisible(true)
                        else
                            Panel_jiazhu_3:setVisible(true)
                        end
                    end
                    xiazhu:setVisible(false)
                elseif obj:getName() == "btn_qipai" then
                    request:sendAction(108)
                    xiazhu:setVisible(false)
                    kanpai:setVisible(false)              
                elseif obj:getName() == "img_button" then
                    print("点击----------------------------",uid,self.mySeatId)
                        request:SendAction(STATE.Look_card,{Uid = uid})
                        kanpai:setVisible(false)
                        self.isKanpai = true
                end
            end
        end

        bipai:addTouchEventListener(callBack)
        genzhu:addTouchEventListener(callBack)
        jiazhu:addTouchEventListener(callBack)
        qipai:addTouchEventListener(callBack)
        kanpai:addTouchEventListener(callBack)
    end


    --下注效果
    function M:showCionEff(data)
        local icon
        if data.data.betstate == 0 then  --not self.isKanpai  nowbrightbet
            icon = display.newSprite("zjh/res/zhajinhua/jinbi01_2x.png")
        else
            icon = display.newSprite("zjh/res/zhajinhua/jinbi02_2x.png")
        end

        local seat = self:getSeatidByUid(data.data.Uid)
        local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)

        local player = cc.uiloader:seekNodeByName(self.gameRoom,"img_cell" .. seat_id)
        local head = cc.uiloader:seekNodeByName(player,"img_head")

        pos = head:convertToWorldSpace(cc.p(head:getPositionX(),head:getPositionY()))

        local jinbi = cc.uiloader:seekNodeByName(self.gameRoom,"panel_jinbi")
        
        local X = math.random(0,200)
        local Y = math.random(100,130)
        print("<<<<<<<<<<<<<<<<<<<<<<<<<<<随即数>>>>>>>>>>>>",X,Y)
        
        pos1 = jinbi:convertToWorldSpace(cc.p(X+80,Y))
        
         
        icon:setName("icon")
        icon:setTag(#self.icon + 5000)
        self.icon[#self.icon + 1] = icon:getTag()

        icon:setPosition(pos)
        self.gameRoom:addChild(icon,1)

        
        icon:runAction(cc.Sequence:create(cc.MoveTo:create(0.1,pos1),cc.CallFunc:create( 
            function (sender)
                print("111111111")
        end)))

        if uid ~= self.selfId then
            local seat = self:getSeatidByUid(data.data.Uid) 
            local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)       
            local pan = cc.uiloader:seekNodeByName(self.gameRoom, "cards_" .. seat_id)
            local kanpai = cc.uiloader:seekNodeByName(pan, "img_button")
            kanpai:setTouchEnabled(false)
        end

    end

     --下注效果
     function M:showCionEff1(uid,daxiao)
        local icon
        if daxiao then
            icon = display.newSprite("zjh/res/zhajinhua/jinbi01_2x.png")
        else
            icon = display.newSprite("zjh/res/zhajinhua/jinbi02_2x.png")
        end

        local seat = self:getSeatidByUid(uid)
        local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)

        local player = cc.uiloader:seekNodeByName(self.gameRoom,"img_cell" .. seat_id)
        local head = cc.uiloader:seekNodeByName(player,"img_head")

        pos = head:convertToWorldSpace(cc.p(head:getPositionX(),head:getPositionY()))

        local jinbi = cc.uiloader:seekNodeByName(self.gameRoom,"panel_jinbi")
        
        local X = math.random(0,200)
        local Y = math.random(100,130)
        print("<<<<<<<<<<<<<<<<<<<<<<<<<<<随即数>>>>>>>>>>>>",X,Y)
        
        pos1 = jinbi:convertToWorldSpace(cc.p(X+80,Y))
        
         
        icon:setName("icon")
        icon:setTag(#self.icon + 5000)
        self.icon[#self.icon + 1] = icon:getTag()

        icon:setPosition(pos)
        self.gameRoom:addChild(icon,1)

        
        icon:runAction(cc.Sequence:create(cc.MoveTo:create(0.1,pos1),cc.CallFunc:create( 
            function (sender)
                print("111111111")
        end)))

        -- if uid ~= self.selfId then
        --     local seat = self:getSeatidByUid(data.data.Uid) 
        --     local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)       
        --     local pan = cc.uiloader:seekNodeByName(self.gameRoom, "cards_" .. seat_id)
        --     local kanpai = cc.uiloader:seekNodeByName(pan, "img_button")
        --     kanpai:setTouchEnabled(false)
        -- end

    end

    --以看牌效果
    function M:yikanpai(data)
        local seat = self:getSeatidByUid(data.data.nextid)
        local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)
        local cards = cc.uiloader:seekNodeByName(self.gameRoom,"cards_"..seat_id)
        if self.selfId ~= data.data.nextid then
        local yikanpai = cc.uiloader:seekNodeByName(cards,"img_button"):setVisible(true)
        --if seat_id ~= 1 then
            yikanpai:setScale(2)
            yikanpai:setLocalZOrder(200)
            yikanpai:setPosition(cc.p(190,5))
            yikanpai:setColor(cc.c3b(160,160,160))
            yikanpai:loadTexture("zjh/res/zhajinhua/cardtype/kanpai_2x.png")
        --end
        end
    end

    --以看牌效果
    function M:yikanpai1(uid)
        local seat = self:getSeatidByUid(uid)
        local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)
        local cards = cc.uiloader:seekNodeByName(self.gameRoom,"cards_"..seat_id)
        --if self.selfId ~= data.data.nextid then
        local yikanpai = cc.uiloader:seekNodeByName(cards,"img_button"):setVisible(true)
        --if seat_id ~= 1 then
            yikanpai:setScale(2)
            yikanpai:setLocalZOrder(200)
            yikanpai:setPosition(cc.p(190,5))
            yikanpai:setColor(cc.c3b(160,160,160))
            yikanpai:loadTexture("zjh/res/zhajinhua/cardtype/kanpai_2x.png")
        --end
        --end
    end

    
    --弃牌效果
    function M:qipai(data)      
        for k,v in pairs(self.playerUidandCards) do
            if v == data.data.Uid then
                table.remove(self.playerUidandCards,k)
            end
        end

        local seat = self:getSeatidByUid(data.data.Uid)
        local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)
        local cards = cc.uiloader:seekNodeByName(self.gameRoom,"cards_"..seat_id)

        local yiqipai = cc.uiloader:seekNodeByName(cards,"img_button")

        if seat_id ~= 1 then
            cards:setColor(cc.c3b(160,160,160))
            yiqipai:setVisible(true)
            yiqipai:setScale(2)
            yiqipai:setLocalZOrder(200)
            yiqipai:setPosition(cc.p(190,5))
            yiqipai:setColor(cc.c3b(160,160,160))
            yiqipai:loadTexture("zjh/res/zhajinhua/cardtype/qipai0_2x.png")
        else
            cards:setColor(cc.c3b(160,160,160))
        end
        if data.data.nextid ~= 0 then
            self:setBetBtn(data)
        end
        
        -- runDelayAction(self.gameRoom,1,function()
        --     if #self.resulTbl > 0 then
        --         self:signResule()
        --     end
        -- end)
        self.yiqi = true
        
        -- local arr = model.roomData._list
        -- for key,var in pairs(arr) do
        --     if var.Uid == data.data.hostid then
               
        --     end
        -- end
    end

    --弃牌效果
    function M:qipai1(uid)
        local seat = self:getSeatidByUid(uid)
        local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)
        local cards = cc.uiloader:seekNodeByName(self.gameRoom,"cards_"..seat_id)
        local yiqipai = cc.uiloader:seekNodeByName(cards,"img_button"):setVisible(true)


        -- if seat_id ~= 1 then
        --     cards:setColor(cc.c3b(160,160,160))

        --     yiqipai:setScale(2)
        --     yiqipai:setLocalZOrder(200)
        --     yiqipai:setPosition(cc.p(190,5))
        --     yiqipai:setColor(cc.c3b(160,160,160))
        --     yiqipai:loadTexture("zjh/res/zhajinhua/cardtype/qipai0_2x.png")
        -- else
            cards:setColor(cc.c3b(160,160,160))
            yiqipai:setScale(2)
            yiqipai:setLocalZOrder(200)
            yiqipai:setPosition(cc.p(190,5))
            yiqipai:loadTexture("zjh/res/zhajinhua/cardtype/qipai0_2x.png")
        -- end
        -- if data.data.nextid ~= 0 then
        --     self:setBetBtn(data)
        -- end
        -- local arr = model.roomData._list
        -- for key,var in pairs(arr) do
        --     if var.Uid == data.data.hostid then
               
        --     end
        -- end
    end

     --效果
     function M:yishu(uid)
        local seat = self:getSeatidByUid(uid)
        local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)
        local cards = cc.uiloader:seekNodeByName(self.gameRoom,"cards_"..seat_id)
        cards:setColor(cc.c3b(160,160,160))
    end

    --比牌
    function M:bipai(uid)
        local arr = model.roomData._list
        if #self.playerUidandCards == 2 then
            for k,v in pairs(self.playerUidandCards) do
                if uid ~= v then
                    request:SendAction(STATE.Start_compcard,{Uid = uid, compareid = v})
                end
            end       
        else
            for k,v in pairs(self.playerUidandCards) do
                if uid ~= v then
                    local seat = self:getSeatidByUid(v)
                    local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)
                    local player = cc.uiloader:seekNodeByName(self.gameRoom,"img_cell" .. seat_id)
                    local bipai = cc.uiloader:seekNodeByName(player,"bipai"):setVisible(true)
                    
                    local function callBack(obj,e)
                        if e == ccui.TouchEventType.ended then
                            -- request:sendActionNum(112,v.Uid)
                            request:SendAction(STATE.Start_compcard,{Uid = uid, compareid = v})
                            self:nobipai(uid)
                        end
                    end
                    bipai:addTouchEventListener(callBack)
                end
            end
        end
    end

    function M:nobipai(uid)
        local arr = model.roomData._list
        for k,v in pairs(arr) do
            if uid ~= v.Uid then
                local seat = self:getSeatidByUid(v.Uid)
                local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)
                local player = cc.uiloader:seekNodeByName(self.gameRoom,"img_cell" .. seat_id)
                local bipai = cc.uiloader:seekNodeByName(player,"bipai"):setVisible(false)
            end
        end
    end

    function M:PKcard(data)
        local PKlater = cc.CSLoader:createNode("zjh/res/PKLayer.csb")
        self.gameRoom:addChild(PKlater,9999)
        
        self.isResult = true

        local PK1 = self:getSeatidByUid(data.data.winid)
        local PK2 = self:getSeatidByUid(data.data.loseid)

        local seat = self:getSeatidByUid(data.data.loseid) 
        local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)       
        local card = cc.uiloader:seekNodeByName(self.gameRoom, "cards_" .. seat_id)
        card:setColor(cc.c3b(160,160,160))
        
        -- local seat = self:getSeatidByUid(data.data.loseid)
        -- table.remove(self.playerUidandCards,seat)
        for k,v in pairs(self.playerUidandCards) do
            if v == data.data.loseid then
                table.remove(self.playerUidandCards,k)
            end
        end
 

        local arr = model.roomData._list
        for key,var in pairs(arr) do
            if var.Uid == data.data.Uid then --data.data.winid
                local player = cc.uiloader:seekNodeByName(PKlater, "img_cell1")
                local head = cc.uiloader:seekNodeByName(player, "img_head_bg")
                local name = cc.uiloader:seekNodeByName(player, "text_name")
                local id = cc.uiloader:seekNodeByName(player,"text_fen_num")
                local card = cc.uiloader:seekNodeByName(PKlater,"panel_car1")
                id:setString(var.yxb)
                
                local voice_bg = cc.Sprite:create()
                voice_bg:setPosition(cc.p(head:getContentSize().width / 2, head:getContentSize().height / 2))
                head:addChild(voice_bg)

                HttpRequest.image(var.FaceUrl,voice_bg,80,function(code)  end)
                name:setString(var.name)
        
                if var.Uid == data.data.loseid then
                    runDelayAction(PKlater,1,function()
                        card:setColor(cc.c3b(160,160,160))
                    end)
                end

            end
            if var.Uid == data.data.compareid then
                local player = cc.uiloader:seekNodeByName(PKlater, "img_cell2")
                
                local head = cc.uiloader:seekNodeByName(player, "img_head_bg")
                local name = cc.uiloader:seekNodeByName(player, "text_name")
                local card = cc.uiloader:seekNodeByName(PKlater,"panel_car2")
 
                local id = cc.uiloader:seekNodeByName(player,"text_fen_num")
                id:setString(var.yxb)

                local voice_bg = cc.Sprite:create()
                voice_bg:setPosition(cc.p(head:getContentSize().width / 2, head:getContentSize().height / 2))
                head:addChild(voice_bg)

                HttpRequest.image(var.FaceUrl,voice_bg,80,function(code)  end)
                name:setString(var.name)

                if var.Uid == data.data.loseid then
                    runDelayAction(PKlater,1,function()
                        card:setColor(cc.c3b(160,160,160))
                    end)
                end

            end

        end
        
        runDelayAction(self.gameRoom,2,function()
            PKlater:removeFromParent()
            if #self.resulTbl > 0 then
                runDelayAction(self.gameRoom,1,function()
                    self:signResule()
                    self.isResult = false
                end)
            else
                self.isResult = false
                self:setBetBtn(data)
                if data.data.nextid ~= self.selfId then
                    local seat = self:getSeatidByUid(data.data.Uid) 
                    local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)       
                    local pan = cc.uiloader:seekNodeByName(self.gameRoom, "cards_" .. seat_id)
                    local kanpai = cc.uiloader:seekNodeByName(pan, "img_button")
                    kanpai:setTouchEnabled(false)
                end
            end

        end)

        -- --if #self.resulTbl > 0 then
        --     print("VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",#self.resulTbl)
        --     runDelayAction(self.gameRoom,3,function()
        --         self:signResule()
        --     end)
        -- --end
    end


    function M:dxsetBetBtn(nextidx,playerstate,_call_typetable,fenshu_P,fenshu_Y)
        print("人个股份股份发过--",nextidx,playerstate,_call_typetable,fenshu_P,fenshu_Y)
        local uid = self:getUidBySeatId(nextidx)
        -- local zhuangSeat = self:getSeatidByUid(self.hostID)
        -- local nextSeat = data.nextidx
        -- if nextSeat + 1 > #model.roomData._list then
        --     nextSeat = 1
        -- else
        --     nextSeat = nextSeat + 1
        -- end
        
        -- if #self.playerUidandCards < #model.roomData._list then
        --     table.insert(self.playerUidandCards,uid)
        -- end
        -- print("NEXTTTTTTTTTTTTTTTTTTTTTTTT",nextSeat,zhuangSeat) 
        -- if nextSeat == zhuangSeat then
        --     if #self.playerUidandCards < #model.roomData._list then
        --         table.insert(self.playerUidandCards,self.hostID)
        --     end 
        -- end

        local xiazhu = cc.uiloader:seekNodeByName(self.gameRoom,"panel_huozhu")
        local xiazhuNum = cc.uiloader:seekNodeByName(self.gameRoom,"panel_bet")
        local xiazhuNum1 = cc.uiloader:seekNodeByName(self.gameRoom,"panel_bet_1")
        local xiazhuNum2 = cc.uiloader:seekNodeByName(self.gameRoom,"panel_bet_2")

        for var = 1,7 do
            local zhu = cc.uiloader:seekNodeByName(self.gameRoom, "btn_" .. var)
            zhu:addTouchEventListener(function (obj,e)
                if e == ccui.TouchEventType.ended then
                    local tag = obj:getTag()
                    request:sendAction(STATE.Bit,{Uid = uid, num = tag,type = 2})
                    xiazhuNum:setVisible(false)
                    xiazhuNum1:setVisible(false)
                    xiazhuNum2:setVisible(false)
                end
            end)
        end

        for var = 9,12 do
            local zhu = cc.uiloader:seekNodeByName(self.gameRoom, "btn_" .. var)
            zhu:addTouchEventListener(function (obj,e)
                if e == ccui.TouchEventType.ended then
                    local tag = obj:getTag()
                    request:sendAction(STATE.Bit,{Uid = uid, num = tag,type = 2})
                    xiazhuNum:setVisible(false)
                    xiazhuNum1:setVisible(false)
                    xiazhuNum2:setVisible(false)
                end
            end)
        end

        for var = 13,16 do
            local zhu = cc.uiloader:seekNodeByName(self.gameRoom, "btn_" .. var)
            zhu:addTouchEventListener(function (obj,e)
                if e == ccui.TouchEventType.ended then
                    local tag = obj:getTag()
                    request:sendAction(STATE.Bit,{Uid = uid, num = tag,type = 2})
                    xiazhuNum:setVisible(false)
                    xiazhuNum1:setVisible(false)
                    xiazhuNum2:setVisible(false)
                end
            end)
        end

        local P = cc.uiloader:seekNodeByName(xiazhu,"btn_P")
        local Y = cc.uiloader:seekNodeByName(xiazhu,"btn_Y")
        local jishu = cc.uiloader:seekNodeByName(xiazhu,"btn_base")
        local huozhu = cc.uiloader:seekNodeByName(xiazhu,"btn_huo")
             
        if uid == self.selfId and playerstate == 1 then
              xiazhu:setVisible(true)
              P:setColor(cc.c3b(255,255,255))
              P:setTouchEnabled(true)
              Y:setColor(cc.c3b(255,255,255))
              Y:setTouchEnabled(true)
              jishu:setColor(cc.c3b(255,255,255))
              jishu:setTouchEnabled(true)
              huozhu:setColor(cc.c3b(255,255,255))
              huozhu:setTouchEnabled(true)

              if _call_typetable == 3 then
                print("亮与不亮------------------------3")
                P:setColor(cc.c3b(160,160,160))
                P:setTouchEnabled(false)
                Y:setColor(cc.c3b(160,160,160))
                Y:setTouchEnabled(false)
              elseif _call_typetable == 4 then
                print("亮与不亮------------------------4")
                jishu:setColor(cc.c3b(160,160,160))
                jishu:setTouchEnabled(false)
                P:setColor(cc.c3b(160,160,160))
                P:setTouchEnabled(false)
                huozhu:setColor(cc.c3b(160,160,160))
                huozhu:setTouchEnabled(false)
              elseif _call_typetable == 5 then
                print("亮与不亮------------------------5")
                P:setColor(cc.c3b(160,160,160))
                P:setTouchEnabled(false)
              elseif _call_typetable == 6 then
                print("亮与不亮------------------------6")
                jishu:setColor(cc.c3b(160,160,160))
                jishu:setTouchEnabled(false)
                Y:setColor(cc.c3b(160,160,160))
                Y:setTouchEnabled(false)
                huozhu:setColor(cc.c3b(160,160,160))
                huozhu:setTouchEnabled(false)
              elseif _call_typetable == 7 then
                print("亮与不亮------------------------7")
                Y:setColor(cc.c3b(160,160,160))
                Y:setTouchEnabled(false)
              end 
        end
        
        local function callBack(obj,e)
            if e == ccui.TouchEventType.ended then
                local fen
                if obj:getName() == "btn_P" then
                    -- if  self.tbl.CurGameNum == 1 then
                    --     fen = self.tangdi/2             
                    -- else
                    --     if self.tangdi%2 == 1 then
                    --         fen = self.tangdi/2 + 5
                    --     else
                    --         fen = self.tangdi/2
                    --     end
                    -- end
                    print("发送--------------------",fenshu_P)
                    request:sendAction(STATE.Bit,{Uid = uid, num = fenshu_P,type = 6})
                    xiazhu:setVisible(false)
                elseif obj:getName() == "btn_Y" then
                    print("发送--------------------",fenshu_Y)
                    request:sendAction(STATE.Bit,{Uid = uid, num = fenshu_Y,type = 4})
                    xiazhu:setVisible(false)
                elseif obj:getName() == "btn_base" then
                    request:sendAction(STATE.Bit,{Uid = uid, num = 10,type = 1})
                    xiazhu:setVisible(false)
                elseif obj:getName() == "btn_huo" then
                    --request:sendAction(STATE.Bit,{Uid = uid, num = 30})
                    xiazhu:setVisible(false)
                    if self.GameRule == 1 then
                        xiazhuNum:setVisible(true)
                    elseif self.GameRule == 2 then
                        xiazhuNum:setVisible(true)
                        xiazhuNum1:setVisible(true)
                    else
                        xiazhuNum:setVisible(true)
                        xiazhuNum1:setVisible(true)
                        xiazhuNum2:setVisible(true)
                    end
                end
            end
        end

        P:addTouchEventListener(callBack)
        Y:addTouchEventListener(callBack)
        jishu:addTouchEventListener(callBack)
        huozhu:addTouchEventListener(callBack)

    end






    
    --显示庄
    function M:setZhuang()

        local seatid = self:getSeatidByUid(self.hostID)

        local seat_id = swichPos(seatid,self.mySeatId,self.playerNum,1)
        
        print("显示庄掉多少下---------------------------------------------------",seat_id)
        local player = cc.uiloader:seekNodeByName(self.gameRoom, "img_cell" .. seat_id)  
     
        local icon = cc.uiloader:seekNodeByName(player, "img_zhuang")
        icon:setVisible(true)
        --self:hideRobZhuang(self.hostID)
        --self:hideRobZhuang()

        -- if self.hostID  and self.curjuNum == 1 then
        --     self:showWinCionEff1(self.hostID)
        -- end
    end

    -- function M:showWinCionEff1(uid)
            
    --         local win = self:getSeatidByUid(uid)
    --         local winseat = swichPos(win,self.mySeatId,self.playerNum,1)
    --         playerWin = cc.uiloader:seekNodeByName(self.gameRoom, "img_player_" .. winseat)
    --         headWin = cc.uiloader:seekNodeByName(playerWin, "head")
            
    --         for var = 1, 10 do
    --         local icon = display.newSprite("jcxj/res/BankerStartGame/jinbi1_2x.png")
    --         if winseat == 1 then
    --             pos = headWin:convertToWorldSpace(cc.p(headWin:getPositionX(),headWin:getPositionY()))
    --         else
    --             pos = headWin:convertToWorldSpace(cc.p(headWin:getPositionX()+100,headWin:getPositionY()-100))
    --         end
            
    --         headLos = cc.uiloader:seekNodeByName(self.gameRoom, "panel_coins") 

    --         pos1 = headLos:convertToWorldSpace(cc.p(headLos:getContentSize().width/2,headLos:getContentSize().height/2 - 40))
            
    --         icon:setPosition(pos)
    --         icon:setScale(2)

    --         self.gameRoom:addChild(icon,1999)
    --         icon:runAction(cc.Sequence:create(cc.MoveTo:create(0.3 + var * 0.03,pos1),cc.CallFunc:create( 
    --             function (sender)
    --                 icon:removeFromParent()
    --                 if var == 10 then
    --                     local coins = cc.uiloader:seekNodeByName(self.gameRoom, "panel_coins"):setVisible(true)
    --                 end
    --              end)))
    --         end

    -- end
    
    -- function M:hideRobZhuang()
    --     local list = model.roomData._list
    --     for k,v in pairs(list) do
    --         -- if v.Uid ~= id then
    --             local seat_id = self:getSeatidByUid(v.Uid)
    --             local seatid = swichPos(seat_id,self.mySeatId,self.playerNum,1)
    --             local player = cc.uiloader:seekNodeByName(self.gameRoom, "cell_" .. seatid)  
    --             --local player = cc.uiloader:seekNodeByName(self.gameRoom, "player" .. v.Uid)
    --             local qz = cc.uiloader:seekNodeByName(player, "shaguo_img")
    --             qz:setVisible(false)    
    --         -- end
    --     end
    -- end

    -- function M:setRobZhuang(data)
        
        -- local seat_id = self:getSeatidByUid(uid)
        -- --local seat = swichPos(seat_id,self.mySeadId ,self.playerNum,1)
        -- --local seat = swichPos(seat_id,self.mySeadId ,self.playerNum,1)
        -- local seat = swichPos(seat_id,self.mySeatId,self.playerNum,1)
        
        -- print("杀过显示相对位置----------------------------",num)
        
        -- local player = cc.uiloader:seekNodeByName(self.gameRoom, "cell_" .. seat)
        -- local qz = cc.uiloader:seekNodeByName(player, "shaguo_img")
        -- local qz = cc.uiloader:seekNodeByName(player, "shaguo_img")
        -- if num == 1 then
        --     print("sha--------------------------------------------")
        --     qz:loadTexture("sgpk/res/actor/sgpk_sha_btn.png", 0)
        -- else
        --     print("guo--------------------------------------------")
        --     qz:loadTexture("sgpk/res/actor/sgpk_guo_btn.png", 0)
        -- end
        -- qz:setVisible(true)
    -- end
    
    
    --  --显示玩家的光圈
    --  function M:showLight(uid)
    --     local arr = model.roomData._list
    --     for k,v in pairs(arr) do
    --         local seatid = self:getSeatidByUid(v.Uid)
    --         local seat_id = swichPos(seatid,self.mySeatId,self.playerNum,1)
    --         local pan = cc.uiloader:seekNodeByName(self.gameRoom, "cell_" .. seat_id)
    --         --local pan = cc.uiloader:seekNodeByName(self.gameRoom, "player" .. v.Uid)
    --         cc.uiloader:seekNodeByName(pan, "light"):setVisible(false)
    --     end
    --     if uid then
    --         local seatid = self:getSeatidByUid(uid)
    --         local seat_id = swichPos(seatid,self.mySeatId,self.playerNum,1)
    --         local pan = cc.uiloader:seekNodeByName(self.gameRoom, "cell_" .. seat_id)
    --         --local pan = cc.uiloader:seekNodeByName(self.gameRoom, "player" .. uid)
    --         cc.uiloader:seekNodeByName(pan, "light"):setVisible(true)
    --         AudioPlayer:playGameSound("sgpk", "bank")
    --     end
    -- end
    
    
   

--     function M:setQiangZhuangBtn(playerstate)
--         local playerArr = model.roomData._list    
--         for key, var in pairs(playerArr) do
--             local uid = model.roomData._list[key].Uid          
--                 if playerstate == 1 and self.mySeatId == key then
--                     print("isQzhuang")
--                     self:showShaGuoBtn(uid)
--                 end
--         end
--     end

--     --隐藏杀过tips
-- function M:hideQizngZhuang()
--     local playerArr = model.roomData._list
--     for key, var in pairs(playerArr) do
--         local seat_id = self:getSeatidByUid(var.Uid)
--         local seatid = swichPos(seat_id, self.mySeatId, self.playerNum,1) --位置转化
--         local player = cc.uiloader:seekNodeByName(self.gameRoom, "cell_" .. seatid)
--         local qz = cc.uiloader:seekNodeByName(player, "shaguo_img")
--         qz:setVisible(false)
--     end
-- end


    -- function M:showShaGuoBtn(uid)
    --     local guo = cc.uiloader:seekNodeByName(self.gameRoom, "guo_btn")
    --     local zhuang = cc.uiloader:seekNodeByName(self.gameRoom, "sha_btn")
    --     local function callBack(obj, e)
    --         if e == ccui.TouchEventType.ended then
    --             if obj:getName() == "guo_btn" then
    --                 --request:onGameBankAction(0)
    --                 request:sendAction(STATE.Rob_zhuang,{Uid = uid, num = 0})
    --             elseif obj:getName() == "sha_btn" then
    --                 --request:onGameBankAction(1)
    --                 request:sendAction(STATE.Rob_zhuang,{Uid = uid, num = 1})
    --             end               
    --             guo:setVisible(false)
    --             zhuang:setVisible(false)
    --         end
    --     end
    --     zhuang:setVisible(true)
    --     zhuang:addTouchEventListener(callBack)
    --     guo:setVisible(true)
    --     guo:addTouchEventListener(callBack)
    -- end
    

    function M:createPlayerCard(data)
        local PlayerArray = model.roomData._list
        print("///////////////////////////////////////////////////\\\n")

        for key, var in pairs(PlayerArray) do
            local seat_id = self:getSeatidByUid(var.Uid)
            local _seatid = swichPos(seat_id,self.mySeatId,self.playerNum,1)
            print("------------ss----------------",key,self.playerNum,_seatid)
            local pan = cc.uiloader:seekNodeByName(self.gameRoom, "cards_" .. _seatid)
            local kanpai = cc.uiloader:seekNodeByName(pan, "img_button")
            print("怎么回事----------------------------",kanpai)
            kanpai:setScale(2)
            kanpai:setLocalZOrder(200)
            kanpai:setPosition(cc.p(500,10))
            kanpai:setColor(cc.c3b(160,160,160))

            local bol = false
            local sc = 0.55
            local offx = 120
            if _seatid ~= 1 then
                sc = 0.3
                offx = 40
            end
            -- dump(self.cards)
            print("==============================================")
            -- AudioPlayer:playGameSound("sgpk","fapai")
            if self.mySeatId == key then
                for k, v in pairs(self.cards) do
                    local str = "common/card/card_6_1.png"
                    print("///////////////////////////////////////////////////")
                    -- if v ~= 0 then
                    --     local typ,val = self:typeAndValue(tonumber(v))
                    --     str = "common/card/card_" .. typ .."_" .. val .. ".png"
                    -- end
                    local eff = display.newSprite(str)
                    eff:setScale(0.3)
                    eff:setPosition(cc.p(self.size.width/2,self.size.height/2))
                    self.gameRoom:addChild(eff)
                    local pos1 = pan:convertToWorldSpace(cc.p( offx * k ,0))
                    local arr = {}
                    arr[#arr + 1] = cc.MoveTo:create(k * 0.03,pos1)
                    arr[#arr + 1] = cc.CallFunc:create(function ()
                        local sp = cc.Sprite:create(str)
                        sp:setPosition(cc.p(250 * k ,0)) --325
                        sp:setScale(1.2)
                        sp:setTag(k*100 + k)
                        sp:setLocalZOrder(k*10 + k)
                        pan:addChild(sp)
                    end)
                    arr[#arr + 1] = cc.RemoveSelf:create()
                    local seq = cc.Sequence:create(arr)
                    eff:runAction(seq)
                    kanpai:setVisible(true)
                end
            else
                for v = 1, 3 do
                    local str = "common/card/card_6_1.png"
                    local eff = display.newSprite(str)
                    eff:setPosition(cc.p(self.size.width/2,self.size.height/2))
                    eff:setScale(0.7)
                    self.gameRoom:addChild(eff)
                    local pos1 = pan:convertToWorldSpace(cc.p( offx * v ,0))
                    local arr = {}
                    arr[#arr + 1] = cc.MoveTo:create(v * 0.03,pos1)
                    arr[#arr + 1] = cc.CallFunc:create(function ()
                         local sp = cc.Sprite:create(str)
                        sp:setPosition(cc.p(100 * v ,0))
                        sp:setScale(0.6)
                        sp:setTag(v*100 + v) 
                        sp:setLocalZOrder(v*10 + v)
                        pan:addChild(sp)
                    end)
                    arr[#arr + 1] = cc.RemoveSelf:create()
                    local seq = cc.Sequence:create(arr)
                    eff:runAction(seq)
                end
            end 
        end   
  
    end

    function M:createPlayerCard1(data)
        local PlayerArray = model.roomData._list
        print("///////////////////////////////////////////////////\\\n")

        for key, var in pairs(data) do
            local seat_id = self:getSeatidByUid(var.Uid)
            local _seatid = swichPos(seat_id,self.mySeatId,self.playerNum,1)
            print("------------ss----------------",key,self.playerNum,_seatid)
            local pan = cc.uiloader:seekNodeByName(self.gameRoom, "cards_" .. _seatid)
            local kanpai = cc.uiloader:seekNodeByName(pan, "img_button")
            print("怎么回事----------------------------",kanpai)
            kanpai:setScale(2)
            kanpai:setLocalZOrder(200)
            kanpai:setPosition(cc.p(500,10))
            kanpai:setColor(cc.c3b(160,160,160))

            local bol = false
            local sc = 0.55
            local offx = 120
            if _seatid ~= 1 then
                sc = 0.3
                offx = 40
            end
            -- dump(self.cards)
            print("==============================================")
            -- AudioPlayer:playGameSound("sgpk","fapai")
            if self.mySeatId == key then
                for k, v in pairs(self.cards) do
                    local str = "common/card/card_6_1.png"
                    print("///////////////////////////////////////////////////")
                    -- if v ~= 0 then
                    --     local typ,val = self:typeAndValue(tonumber(v))
                    --     str = "common/card/card_" .. typ .."_" .. val .. ".png"
                    -- end
                    local eff = display.newSprite(str)
                    eff:setScale(0.3)
                    eff:setPosition(cc.p(self.size.width/2,self.size.height/2))
                    self.gameRoom:addChild(eff)
                    local pos1 = pan:convertToWorldSpace(cc.p( offx * k ,0))
                    local arr = {}
                    arr[#arr + 1] = cc.MoveTo:create(k * 0.03,pos1)
                    arr[#arr + 1] = cc.CallFunc:create(function ()
                        local sp = cc.Sprite:create(str)
                        sp:setPosition(cc.p(250 * k ,0)) --325
                        sp:setScale(1.2)
                        sp:setTag(k*100 + k)
                        sp:setLocalZOrder(k*10 + k)
                        pan:addChild(sp)
                    end)
                    arr[#arr + 1] = cc.RemoveSelf:create()
                    local seq = cc.Sequence:create(arr)
                    eff:runAction(seq)
                    kanpai:setVisible(true)
                end
                if data[key].checkstate == 1 then --以看牌
                    -- self:yishu(data[key].Uid)
                elseif data[key].playstate == -1 then --弃牌
                    self:yishu(data[key].Uid)
                elseif data[key].playstate == 0 then --以输
                    self:yishu(data[key].Uid)
                end
            else
                if data[key].checkstate == 1 then --以看牌
                    self:yikanpai1(data[key].Uid)
                elseif data[key].playstate == -1 then --弃牌
                    self:qipai1(data[key].Uid)
                elseif data[key].playstate == 0 then --以输
                    self:yishu(data[key].Uid)
                end
                for v = 1, 3 do
                    local str = "common/card/card_6_1.png"
                    local eff = display.newSprite(str)
                    eff:setPosition(cc.p(self.size.width/2,self.size.height/2))
                    eff:setScale(0.7)
                    self.gameRoom:addChild(eff)
                    local pos1 = pan:convertToWorldSpace(cc.p( offx * v ,0))
                    local arr = {}
                    arr[#arr + 1] = cc.MoveTo:create(v * 0.03,pos1)
                    arr[#arr + 1] = cc.CallFunc:create(function ()
                         local sp = cc.Sprite:create(str)
                        sp:setPosition(cc.p(100 * v ,0))
                        sp:setScale(0.6)
                        sp:setTag(v*100 + v) 
                        sp:setLocalZOrder(v*10 + v)
                        pan:addChild(sp)
                    end)
                    arr[#arr + 1] = cc.RemoveSelf:create()
                    local seq = cc.Sequence:create(arr)
                    eff:runAction(seq)
                end
            end 
        end   
    end



    --设置玩家位置属性
    function M:createPlayer()
        local PlayerArray = model.roomData._list
        local main = cc.uiloader:seekNodeByName(self.gameRoom, "img_bg")  
        main:removeAllChildren()
        for key, var in pairs(PlayerArray) do

            local seat_id = self:getSeatidByUid(var.Uid)
            --新加的测试
            local seatid = swichPos(seat_id,self.mySeatId,self.playerNum,1)        --位置转化
            --local cel = cc.uiloader:seekNodeByName(self.gameRoom, "cell"):clone()
            local cel = cc.uiloader:seekNodeByName(self.gameRoom, "img_cell" .. seatid):setVisible(true)
            print("ssssssssssssssssssssssssssss ",seatid,self.playerNum,self.mySeatId,key)
        
            cel:setLocalZOrder(1)

            local btn = cc.uiloader:seekNodeByName(cel, "btn_avater")
            btn:setTag(var.Uid)
            btn:addTouchEventListener(
                function(obj, e)
                    if e == ccui.TouchEventType.ended then
                        --AudioPlayer:playGameSound("jcxj", "btn")
                        self:setRoleInfo(obj:getTag())
                    end
                end
            )

            if self.GameOwner == key then
                cc.uiloader:seekNodeByName(cel, "img_fanzhu"):setVisible(true)
            end
            
            local head = cc.uiloader:seekNodeByName(cel, "img_head"):setVisible(true)
            local name = cc.uiloader:seekNodeByName(cel, "lb_name"):setVisible(true)

            local id = cc.uiloader:seekNodeByName(cel,"lb_nam")
            id:setString(var.yxb)

            local voice_bg = cc.Sprite:create()
            voice_bg:setPosition(cc.p(head:getContentSize().width / 2, head:getContentSize().height / 2))
            head:addChild(voice_bg)

            HttpRequest.image(var.FaceUrl,voice_bg,99,function(code)  end)
            name:setString(var.name)
                -- HttpRequest.image(
                --     info.FaceUrl,
                --     head,
                --     91,
                --     function(code)
                --     end
                -- )
                -- name:setString(info.NickName)

            
            -- cc.uiloader:seekNodeByName(cel, "name"):setString(var.name)
            -- local head = cc.uiloader:seekNodeByName(cel,"head_img")
            -- HttpRequest.image(var.FaceUrl,head,91,function(code)  end)
    
            -- cc.uiloader:seekNodeByName(cel, "score"):setString(var.yxb)
            --main:addChild(cel)
            -- local pan = cc.uiloader:seekNodeByName(self.gameRoom, "cards"):clone()
            -- pan:setName("cards" .. seatid)
            -- pan:setPosition(cc.p(self.size.width * pos1[seatid][1], self.size.height * pos1[seatid][2])) -- 
            -- main:addChild(pan)
           
            --cc.uiloader:seekNodeByName(cel, "id"):setString(var.ZJScore)

        end
        self:showStartOrFriend()
    end

    --设置开始，邀请按钮
    function M:showStartOrFriend()
        local jiesan = cc.uiloader:seekNodeByName(self.gameRoom, "btn_jiesanfj")
        local back = cc.uiloader:seekNodeByName(self.gameRoom, "btn_returnhall")
        local friend = cc.uiloader:seekNodeByName(self.gameRoom, "btn_yaoqin")
        local start = cc.uiloader:seekNodeByName(self.gameRoom, "btn_zunbei")
        print("=========================================//////////////////")
        start:stopAllActions()
        friend:stopAllActions()
        if self.GameOwner == self.mySeatId then
            if  model.roomData._list[self.mySeatId].b_start == 0 then
                local zhubei = cc.uiloader:seekNodeByName(self.gameRoom, "panel_zunbei"):setVisible(true) 
            end
            back:setVisible(false)
        else
            local zhubei = cc.uiloader:seekNodeByName(self.gameRoom, "panel_zunbei"):setVisible(true)
            jiesan:setVisible(false)
        end
    end
    
    --设置开始，邀请按钮
    function M:hideBtnStartAndFriend()
        local zhubei = cc.uiloader:seekNodeByName(self.gameRoom, "panel_zunbei"):setVisible(false)
        local arr = model.roomData._list
        for key, var in pairs(arr) do
            local seat = self:getSeatidByUid(var.Uid)
            local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)
            -- local player = cc.uiloader:seekNodeByName(self.gameRoom,"cell_" .. seat_id)
            -- cc.uiloader:seekNodeByName(player, "ready"):setVisible(false)
            local player = cc.uiloader:seekNodeByName(self.gameRoom, "img_cell".. seat_id)
            local ready = cc.uiloader:seekNodeByName(player, "img_zb"):setVisible(false)
        end
    end
    
    function M:setRoleInfo(id)
        local main = cc.CSLoader:createNode("zjh/res/UserInfoLayer.csb")
        self.gameRoom:addChild(main,999)
        local head = cc.uiloader:seekNodeByName(main, "Image_3"):setVisible(true)
        local name = cc.uiloader:seekNodeByName(main, "text_name")
        local idText = cc.uiloader:seekNodeByName(main, "text_id")
        local ip = cc.uiloader:seekNodeByName(main, "text_ip")
        cc.uiloader:seekNodeByName(main, "btn_close"):addTouchEventListener(function (obj,e)
            if e == ccui.TouchEventType.ended then
                --AudioPlayer:playGameSound("sgpk","btn")
                main:removeFromParent()        
            end
        end)
        local seatid = self:getSeatidByUid(id)
        local info = model.roomData._list[seatid]
        if info then
            local voice_bg = cc.Sprite:create()
            voice_bg:setPosition(cc.p(head:getContentSize().width / 2, head:getContentSize().height / 2))
            head:addChild(voice_bg)
            HttpRequest.image(info.FaceUrl,voice_bg,110,function(code)  end)
            name:setString(info.name)
            idText:setString("ID:" .. info.Uid)
            ip:setString("IP:" .. (info.IP and info.IP or "127.0.0.1"))
        end

        -- local main = cc.CSLoader:createNode("sgpk/res/playerInfo.csb")
        -- self.gameRoom:addChild(main,999)
        -- local head = cc.uiloader:seekNodeByName(main, "head")
        -- local name = cc.uiloader:seekNodeByName(main, "Text_name")
        -- local idText = cc.uiloader:seekNodeByName(main, "Text_ID")
        -- local ip = cc.uiloader:seekNodeByName(main, "Text_IP")
        -- cc.uiloader:seekNodeByName(main, "Button_close"):addTouchEventListener(function (obj,e)
        --     if e == ccui.TouchEventType.ended then
        --         AudioPlayer:playGameSound("sgpk","btn")
        --         main:removeFromParent()        
        --     end
        -- end)
        -- local seatid = self:getSeatidByUid(id)
        -- local info = model.roomData._list[seatid]
        -- if info then
        --     HttpRequest.image(info.FaceUrl,head,79,function(code)  end)
        --     name:setString(info.name)
        --     idText:setString("ID:" .. info.Uid)
        --     ip:setString("IP:" .. (info.IP and info.IP or "127.0.0.1"))
        -- end
    end 

    function M:getSeatidByUid( id )
        local PlayerArray = model.roomData._list
        print("function M:getSeatidByUid( id )---------------------------------")
        for k,v in pairs(PlayerArray) do
            if v.Uid == id then
                print("----------------------------->key = ",k)
                return k
            end
        end
    end
    
    function M:getUidBySeatId(seatid)
        local PlayerArray = model.roomData._list
        for k,v in pairs(PlayerArray) do
            if k == seatid then
                return v.Uid
            end
        end
    end

    --转换值
    function M:typeAndValue(card)
        local dataValue = {}
        local typ,val = 1,1
        typ = math.modf(card/16)
        val = card - (typ * 16)
        return typ,val
    end

    function M:resultData(data)
        self.ResulTbl = data
        -- self:result()
        if not self.isResult then
            self:result()
        end
    end
    
    
    function M:result()
        local result = cc.CSLoader:createNode("zjh/res/RecordLayer.csb")
        self.gameRoom:addChild(result, 999)
        local btn = cc.uiloader:seekNodeByName(result, "Button_back")
        btn:addTouchEventListener(
            function(obj, e)
                if e == ccui.TouchEventType.ended then
                    -- AudioPlayer:playGameSound("sgpk", "btn")
                    result:removeFromParent()
                    MVC.gameExit()
                end
            end
        )
        local btn = cc.uiloader:seekNodeByName(result, "Button_fenxiang")
        btn:addTouchEventListener(
            function(obj, e)
                if e == ccui.TouchEventType.ended then
                    -- AudioPlayer:playGameSound("sgpk", "btn")
                    -- self:action_game_exit(true)
                    -- PlatForm.PlatformTool:screenShot() 
                    PlatForm.PlatformTool:screenShot()
                    -- MVC.elementStop()
                    -- MVC.reInGame()

                end
            end
        )
        
        local data = os.date("%Y-%m-%d %H:%M:%S");  --当前时间
        cc.uiloader:seekNodeByName(result, "text_time"):setString(data)
        cc.uiloader:seekNodeByName(result, "text_fanghao"):setString("房间号:" .. model.roomData._roomid)
      
        
        local list = cc.uiloader:seekNodeByName(result, "scroll")
        list:removeAllChildren()

        local playerArr = model.roomData._list

        local dyjCl = nil
        local scoreMax = 0
        

        for key, var in pairs(playerArr) do
            local cl = cc.uiloader:seekNodeByName(result, "img_cell"):clone()
            cc.uiloader:seekNodeByName(cl, "img_fanzhu"):setVisible(false)

            local SeatId = self:getSeatidByUid(var.Uid)
            if self.GameOwner == key then
                cc.uiloader:seekNodeByName(cl, "img_fanzhu"):setVisible(true)                                               
            end

            local head = cc.uiloader:seekNodeByName(cl, "img_head"):setVisible(true)
            local voice_bg = cc.Sprite:create()
            voice_bg:setPosition(cc.p(head:getContentSize().width / 2, head:getContentSize().height / 2))
            head:addChild(voice_bg)
            HttpRequest.image(var.FaceUrl,voice_bg,91,function(code)  end) --txt_name
            cc.uiloader:seekNodeByName(cl, "text_name"):setString(var.name)
            cc.uiloader:seekNodeByName(cl, "text_id"):setString("ID:" .. var.Uid)
            
            cc.uiloader:seekNodeByName(cl, "text_baozhi"):setString(self.ResulTbl[key].baozi)
            cc.uiloader:seekNodeByName(cl, "text_shunjin"):setString(self.ResulTbl[key].shunjin)
            cc.uiloader:seekNodeByName(cl, "text_jinhua"):setString(self.ResulTbl[key].jinhua)
            cc.uiloader:seekNodeByName(cl, "text_shenli"):setString(self.ResulTbl[key].wintimes)
            -- cc.uiloader:seekNodeByName(cl, "text_zhong"):setString(self.ResulTbl[key].money)

            -- if key <= 3 then
            --     cl:setPosition(cc.p(200 + (key - 1) * 360,360))
            -- else
            --     cl:setPosition(cc.p(200 + ((key-3) - 1) * 360,130))
            -- end
            cl:setPosition(cc.p(110 + (key - 1) * 230,200))

            local totleScore = self:createImageNum(self.ResulTbl[key].money) --self.ResulTbl[key].money
            totleScore:setScale(0.8)
            totleScore:setName(key)
            totleScore:setPosition(cc.p(180, 50))   
            cl:addChild(totleScore)
            if scoreMax < self.ResulTbl[key].money then
                scoreMax = self.ResulTbl[key].money
                dyjCl = cl
            end

            
            cl:setVisible(true)
            list:addChild(cl)
        end
        if dyjCl then
            cc.uiloader:seekNodeByName(dyjCl, "img_dayinjia"):setVisible(true)
        end     


        -- local list = cc.uiloader:seekNodeByName(result, "Panel_2")
        -- list:removeAllChildren()
        -- local bg = cc.uiloader:seekNodeByName(result, "bg")
        
        -- local playerArr = model.roomData._list
        
        -- local dyjCl = nil
        -- local scoreMax = 0

        -- for key, var in pairs(playerArr) do
        --     local cl = cc.uiloader:seekNodeByName(result, "cell"):clone()
        --     local SeatId = self:getSeatidByUid(var.Uid)
        --     if self.GameOwner == key then
        --          cc.uiloader:seekNodeByName(cl, "master"):setVisible(true)
        --     end
        --     cc.uiloader:seekNodeByName(cl, "id"):setString("ID:" .. self.resulTbl[key].Uid)
        --     cc.uiloader:seekNodeByName(cl, "text_1"):setString("通杀次数: " .. self.resulTbl[key].PassToKill)
        --      --通杀
        --     cc.uiloader:seekNodeByName(cl, "text_2"):setString("通赔次数: " .. self.resulTbl[key].Compensation)
        --      --通赔
        --     cc.uiloader:seekNodeByName(cl, "text_3"):setString("三公次数: " .. self.resulTbl[key].ThreeCounsellors)
        --      --三公数量
        --     cc.uiloader:seekNodeByName(cl, "text_4"):setString("赢局次数: " .. self.resulTbl[key].WinNum)
        --      --赢局累计
        --      cl:setPosition(cc.p(110 + (key - 1) * 210,230))

            -- local totleScore = self:createImageNum(self.resulTbl[key].yxb) 
            -- totleScore:setScale(0.8)
            -- totleScore:setName(key)
            -- totleScore:setPosition(cc.p(165, 100))
            -- cl:addChild(totleScore)
        --     if scoreMax < self.resulTbl[key].money then
        --         scoreMax = self.resulTbl[key].money
        --         dyjCl = cl
        --     end
           
            
        --     local head = cc.uiloader:seekNodeByName(cl, "head_bg")
        --     local voice_bg = cc.Sprite:create()
        --     voice_bg:setPosition(cc.p(head:getContentSize().width / 2, head:getContentSize().height / 2))
        --     head:addChild(voice_bg)
        --     local name = cc.uiloader:seekNodeByName(cl, "name")

        --     HttpRequest.image(var.FaceUrl,voice_bg,70,function(code)  end)
        --     name:setString(var.name)


        --     cl:setVisible(true)
        --     list:addChild(cl)
        -- end
        -- if dyjCl then
        --     cc.uiloader:seekNodeByName(dyjCl, "dyj"):setVisible(true)
        -- end     
     end

     function M:createImageNum(num)
        local totleScore = nil
        local str = ":"
        if num >= 0 then
            totleScore = cc.Label:createWithCharMap("zjh/res/jiesuan/02.png", 25, 30, string.byte("0"))  --jcxj/res/gameover/MJ_win_score_font.png 28, 38, string.byte("0")
        else
            str = ":"
            totleScore = cc.Label:createWithCharMap("zjh/res/jiesuan/01.png", 25, 30, string.byte("0"))
        end
        
        totleScore:setString(str .. num)
        return totleScore
    end
    

    



     --游戏退出\
     function M:exit(bol)
        print("游戏退出")
        if self.diMisScheduler then
            scheduler.unscheduleGlobal(self.diMisScheduler)
            self.diMisScheduler = nil
        end    
        if self.handler then
            scheduler.unscheduleGlobal(self.handler)
            self.handler = nil
        end          
        --MVC.facade:cancelGameActor(gamename,".src.game")
        --view = nil
        self.dismissLayer = nil
        self:reSetData()--数据重设置
        model.gameData = {}
        model.roomData = {}
    end

    --玩家聊天
    function M:chat(param)  --更新玩家状态 
        --玩家文字表情聊天
        local data = param.data
        local pList = model.roomData._list
        if data.name == "text" then  --文字聊天
            --local uid = self:getUidBySeatId(param.Uid)
            local seat = self:getSeatidByUid(data.Uid)
            local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)
            local pl = cc.uiloader:seekNodeByName(self.gameRoom,"img_cell" .. seat_id)
            local chat_node = cc.uiloader:seekNodeByName(pl,"chat")
            chat_node:setVisible(true)
            local arr = {}
            arr[#arr + 1] = cc.DelayTime:create(2)
            arr[#arr + 1] = cc.CallFunc:create(  
                function (sender)  
                    chat_node:setVisible(false)
                end)
            local seq = cc.Sequence:create(arr)
            chat_node:runAction(seq)
    
            cc.uiloader:seekNodeByName(chat_node,"chat_text"):setString(data.value)
            local info = pList[self:getSeatidByUid(data.Uid)]
            --播放短语语音
            if info then
                AudioPlayer:playTextChatSound(info,data.value)
            end
        elseif data.name == "brow" then --表情聊天
            local seat = self:getSeatidByUid(data.Uid)
            local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)
            local pl = cc.uiloader:seekNodeByName(self.gameRoom,"img_cell" .. seat_id)
            local role = cc.uiloader:seekNodeByName(pl,"img_head")
            pl:addChild(Effects:getBrowAnimationById(data.value,cc.p(role:getPositionX(),role:getPositionY()),100))
        end
    end

    --语音聊天
    function M:voice(param)
        print("语音聊天-------------------------")
        local seat = self:getSeatidByUid(param.Uid)
        local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)
        local pl = cc.uiloader:seekNodeByName(self.gameRoom,"img_cell" .. seat_id)
        local role = cc.uiloader:seekNodeByName(pl,"img_head")
        local voice_bg = cc.Sprite:create("zjh/res/zhajinhua/yuyin_bg.png")
        voice_bg:setPosition(cc.p(role:getContentSize().width/2,role:getContentSize().height/2))
        voice_bg:setLocalZOrder(100)
        role:addChild(voice_bg)
        print("1111111111111111语音聊天-------------------------",voice_bg)
        local animate=Effects:getAnimation("voice",4)
        local sp=display.newSprite("#voice0.png")
        sp:setPosition(voice_bg:getContentSize().width/2,40)
        sp:playAnimationForever(animate)
        voice_bg:addChild(sp)
    
        local arr = {}
        arr[#arr + 1] = cc.DelayTime:create(param.time+1)
        arr[#arr + 1] = cc.CallFunc:create(function ()
             voice_bg:removeFromParent()
             AudioPlayer:resumeMusic()
             MVC.facade:send(Event.EVENT_COMMON_ACTION,"voiceOver")
        end)
        local seq = cc.Sequence:create(arr)
        voice_bg:runAction(seq)      
    end

    function M:leave(data)
        -- dump(data)
        if data.succode == 1 then
            local seat = self:getSeatidByUid(data.idx)
            local seatt_id = swichPos(seat,self.mySeatId,self.playerNum,1)
            local pl = cc.uiloader:seekNodeByName(self.gameRoom,"img_cell" .. seatt_id):setVisible(false)
            dump(data)
            if self.selfId == data.idx then
                MVC.gameExit()
            end
        else
            Prompt.ShowNoticeSysMsg(TEXT("游戏已开始，离开房间失败"))
        end
        -- --local uid = self:getUidBySeatId( data.SeatId )
        -- local seat_id = swichPos(data.SeatId,self.mySeatId,self.playerNum,1)
        -- local player = cc.uiloader:seekNodeByName(self.gameRoom, "img_player_" .. seat_id)
        -- player:removeFromParent()
    end

     --更新手机状态
     function M:updatePhone(data)
        -- local tex = cc.uiloader:seekNodeByName(self.gameRoom, "Text_ostime")
        -- if tex then
        --     tex:setString(os.date("%H:%M",os.time()))
        -- end
        -- local img1 = cc.uiloader:seekNodeByName(self.gameRoom, "dianliang")
        -- if img1 then
        --     img1:loadTexture("sgpk/res/actor/dl_" .. data.Battery .. ".png")
        -- end
        -- local img2 = cc.uiloader:seekNodeByName(self.gameRoom, "wifi")
        -- if img2 then
        --     img2:loadTexture("sgpk/res/actor/wifi_" .. 4 .. ".png")--Data.Wifi
        -- end
    end

     --玩家状态
     function M:playerState(data)
        print("玩家上线 ----------------- UID = ")

        local uid = self:getUidBySeatId(math.abs( data[1] ))
        local seat = self:getSeatidByUid(uid)
        local seat_id = swichPos(seat,self.mySeatId,self.playerNum,1)

        local pan = cc.uiloader:seekNodeByName(self.gameRoom, "img_cell" .. seat_id)
        local lixian = cc.uiloader:seekNodeByName(pan, "lixian")
        local head = cc.uiloader:seekNodeByName(pan, "img_head")
        if data[1] > 0 then
            lixian:setVisible(false)
            setAvatarAray(head,false)
        else
            lixian:setVisible(true)
            setAvatarAray(head,true)
        end

    end

    function M:getSex(seatid)
        local info = model.roomData._list[seatid]
        local tempSex="woman"
        if info then
            if info.Gender==1 then
                tempSex="man"
            end
        end
        return tempSex
    end
    
    --更新手机:时间电量wifi
function M:update_element(data) 
	self.time:setString(os.date("%H:%M",os.time()))
    self.dianliang:loadTexture("jcxj/res/BankerStartGame/dian0"..tostring(data.Battery)..".png")
    self.wifi:loadTexture("jcxj/res/BankerStartGame/wifi0"..tostring(data.Wifi)..".png")
end



    -- function M:table_copy_table(ori_tab)
    --     if (type(ori_tab) ~= "table") then
    --         return nil
    --     end
    --     local new_tab = {}
    --     for i,v in pairs(ori_tab) do
    --         local vtyp = type(v)
    --         if (vtyp == "table") then
    --             new_tab[i] = self:table_copy_table(v)
    --         elseif (vtyp == "thread") then
    --             new_tab[i] = v
    --         elseif (vtyp == "userdata") then
    --             new_tab[i] = v
    --         else
    --             new_tab[i] = v
    --         end
    --     end
    --     return new_tab
    -- end
    


    
    return M
 
    
  

    
    
